1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Error when using underscores in attribute names in a custom module

Error when using underscores in attribute names in a custom module

1 posts, 0 answered
  1. Travis
    Travis avatar
    86 posts
    Registered:
    15 Oct 2008
    15 May 2012
    Link to this post
    Hello,
    I'm running an instance of Sitefinity 5.0.2500, and I'm working with developing custom modules. I was attempting to add an attribute to my Model.Item class (that is, my data item class) that contained an underscore in it. For example:

    private string first_Name;
     
    [DataMember]
    public string FirstName { get { return first_Name; } set { first_Name = value; } }

    As you can see, I have an attribute with the name "first_Name". With this present, any time I attempt to build by project (which contains my module) results in a build error that states the following:
    Error   78  There is no field with name 'firstName' backing 'FirstName' property in type 'PrimaryFMAs.Model.PrimaryFMAItem'. You need to either change the Field Naming rules of the mapping configuration object or call HasFieldName(string) with the name of the backing field.
    ExceptionString:
    System.MissingFieldException: There is no field with name 'firstName' backing 'FirstName' property in type 'PrimaryFMAs.Model.PrimaryFMAItem'. You need to either change the Field Naming rules of the mapping configuration object or call HasFieldName(string) with the name of the backing field.
       at Telerik.OpenAccess.Metadata.Fluent.PropertyInfoHelper.GetFieldInfo(String fieldName, String propertyName, Type type)
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.GetMemberType()
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.AddConceptualItem(FluentMetadataSource fluentMappingSource, MetaPersistentType persistentType)
       at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.AddEntityMapping(MetadataContainer metadataContainer, MetaTable table)
       at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.AddEntityMapping(MetadataContainer metadataContainer)
       at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.CreateModel()
       at Telerik.Sitefinity.Data.OA.SitefinityMetadataSourceBase.CreateModel()
       at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.GetModelCore(MetadataContainer model)
       at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
       at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun() C:\inetpub\wwwroot\_Shootmeintheface_a\PrimaryFMA\obj\Debug\PrimaryFMACatalogSample.dll PrimaryFMACatalogSample

    Obviously, I was able to get around this by removing the underscores from my attributes, but, I just wanted to post this here in case someone else came accross this issue and didn't understand why.
1 posts, 0 answered