fluent code generation error

3 posts, 0 answers
  1. Axe
    Axe avatar
    88 posts
    Member since:
    Feb 2007

    Posted 26 Feb 2012 Link to this post

    i'm using Q1 2012 to generate from database. I have column Timestamp of type timestamp concurrency member is set to Timestamp and concurrency mode is timestamp and everything works as expected when using XML mapping type for code generation. When I change to fluent I get build error: 

    Error   4   There is a version property 'Timestamp.' specified in type 'Tls.Data.Artist', however the type is configured to use 'Timestamp' concurrency control instead of Version
    ExceptionString:
    System.InvalidOperationException: There is a version property 'Timestamp.' specified in type 'Tls.Data.Artist', however the type is configured to use 'Timestamp' concurrency control instead of Version
       at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.ThrowInvalidConcurrency(MemberInfo versionMember)
       at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.ProcessConcurrencyControl()
       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.ProcessEntities(MetadataContainer metadataContainer)
       at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.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() F:\Projects\Tls.Data\obj\Debug\Tls.Data.dll    Tls.Data

    Here is the mapping:

    public MappingConfiguration<Artist> GetArtistMappingConfiguration()
    {
        MappingConfiguration<Artist> configuration = this.GetArtistClassConfiguration();
                    this.PrepareArtistPropertyConfigurations(configuration);
            this.PrepareArtistAssociationConfigurations(configuration);
            return configuration;
    }
    public MappingConfiguration<Artist> GetArtistClassConfiguration()
    {
        MappingConfiguration<Artist> configuration = new MappingConfiguration<Artist>();
        configuration.MapType().WithDataAccessKind(DataAccessKind.ReadWrite).WithConcurencyControl(OptimisticConcurrencyControlStrategy.Timestamp).ToTable("Artist");
     
        return configuration;
    }
     
    public void PrepareArtistPropertyConfigurations(MappingConfiguration<Artist> configuration)
    {
        configuration.HasProperty(x => x.Timestamp).HasFieldName("timestamp").IsVersion().WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Timestamp").IsNotNullable().HasColumnType("timestamp").HasPrecision(0).HasScale(0);
        configuration.HasProperty(x => x.Name).HasFieldName("name").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Name").IsNotNullable().HasColumnType("nvarchar").HasLength(200);
        configuration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc).HasFieldName("id").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Id").IsNotNullable().HasColumnType("int").HasPrecision(0).HasScale(0);
    }
  2. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 29 Feb 2012 Link to this post

    Hello Alex,

     We did locate some wrong behavior with this setup in our Fluent Mapping API. However, I believe that if you set the concurrency mode to Default, the issue should no longer persist. The OpenAccess runtime will resolve the Default setting to the correct one, so this should be a valid workaround at the moment. Anyway, I would like to ask you to send us your .rlinq file if possible so we can continue our local testing of the issue locally using it.

    Greetings,
    Zoran
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
  3. DevCraft banner
  4. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 21 Mar 2012 Link to this post

    Hi Alex,

     I would just like to give you a follow up on the issue reported in this forum thread. We located the bug that was causing this behavior and the bug is already fixed. The fix will be available in our next internal build. In the meantime you can use XML-based mapping in order to workaround the issue.

    Greetings,
    Zoran
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top