Glue supports mapping between properties, methods and fields. But it is supported in different ways. Here the differences are explained.
Properties are the default, everything explained about Glue (unless stated otherwise) is valid for properties.
You can specify relations both away from and towards fields, like you specify a normal relation:
As fields are considered a special case, by default fields will not be autorelated. To also autorelate fields, you must specify it explicitly:
var autoRelateFields = true;
Note also that the relationsverification will not
fail even if fields are not related:
(For complete example download the source, check out the Fields.cs in the GlueExamples-project)
A method can be used as a read only property in Glue. Which means you can have relations away from methods:
mapping.RelateTowardsRight(domain => domain.GetId(), gui => gui.Id);
but not towards methods:
mapping.RelateTowardsLeft(domain => domain.GetId(), gui => gui.Id)
Note that with methods you can't autorelate, and you the relationsverification will not check for methods.
(For complete example download the source, check out the Methods.cs in the GlueExamples-project)