This question is locked. New answers and comments are not allowed.
First off, I am new at using OpenAccess, so hopefully this will be a simple issue that I just haven't figured out yet.
When building my project I am getting the error, "There is not field with the name 'id' backing 'Id' property in the type 'Address'..."
My address object includes a backing object that is not exposed publicly, but the fields are mapped to allow access without exposing implementation. Here is an example:
I have tried using the .HasFieldName() method in a variety of ways, but I cannot get it to map the Id field.
Why does the MappingConfiguration care at all what my implementation is? Wouldn't it make sense to just use the publicly-exposed property rather than trying to access a private field that may or may not actually exist?
Like I said, I'm very new to OpenAccess, so perhaps I am just missing something here.
Thanks in advance for your help.
Brad Harris
When building my project I am getting the error, "There is not field with the name 'id' backing 'Id' property in the type 'Address'..."
My address object includes a backing object that is not exposed publicly, but the fields are mapped to allow access without exposing implementation. Here is an example:
public class BaseItem{ public int Id { get; set; } // ... other logic ...}public class Address{ private BaseItem BaseItem { get; set; }; public int Id { get { return this.BaseItem.Id; } set { this.BaseItem.Id = value; } }}public class SampleMetaData : FluentMetadataSource{ protected override IList<MappingConfiguration> PrepareMapping() { List<MappingConfiguration> configurations = new List<MappingConfiguration> (); MappingConfiguration<Address> addressConfig = new MappingConfiguration<Address> (); addressConfig.MapType ( x => new { Id = x.Id } ).ToTable ( "Addresses" ); addressConfig.HasProperty ( x => x.Id ).IsIdentity ( KeyGenerator.Autoinc ); configurations.Add ( addressConfig ); return configurations; }}I have tried using the .HasFieldName() method in a variety of ways, but I cannot get it to map the Id field.
Why does the MappingConfiguration care at all what my implementation is? Wouldn't it make sense to just use the publicly-exposed property rather than trying to access a private field that may or may not actually exist?
Like I said, I'm very new to OpenAccess, so perhaps I am just missing something here.
Thanks in advance for your help.
Brad Harris