This is a migrated thread and some comments may be shown as answers.

fluent code generation error

2 Answers 45 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Axe
Top achievements
Rank 1
Axe asked on 26 Feb 2012, 06:16 AM
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 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 29 Feb 2012, 06:05 PM
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 >>
0
Zoran
Telerik team
answered on 21 Mar 2012, 03:21 PM
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 >>
Tags
Design Time (Visual Designer & Tools)
Asked by
Axe
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Share this question
or