fluent versioning and type mapping help, please
fluent versioning and type mapping help, please
I am attempting to implement a fluent mapping of our existing C# class hierarchy (in order to avoid changing the classes being mapped), but I seem to be unable to mark the property with the "IsVersion()" tag - the method seems to simply not exist in the property hierarchy . What Am I doing wrong here?
Also we have many complex nested data structures which are never searched, that we wish to simply serialize and store a text value for (and deserialize upon rehydration). Is there any way via mapping (e.g. by means of a lambda expression) to map the data being stored/retrieved other than implementing a hidden member and using custom accessors.
for example
public HashSet<MyClass> member1;
it would be nice if the fluent mapper could be told to take the actual value of member1 and transform it via a call to my code and store the resulting string in the DB column. Similarly in reverse upon fetching the object.
Thanks
Also we have many complex nested data structures which are never searched, that we wish to simply serialize and store a text value for (and deserialize upon rehydration). Is there any way via mapping (e.g. by means of a lambda expression) to map the data being stored/retrieved other than implementing a hidden member and using custom accessors.
for example
public HashSet<MyClass> member1;
it would be nice if the fluent mapper could be told to take the actual value of member1 and transform it via a call to my code and store the resulting string in the DB column. Similarly in reverse upon fetching the object.
Thanks
Re: fluent versioning and type mapping help, please
There is .IsRowVersion() method when working with the fluent mapping approach, however, it is available only for the binary properties. For example:unclelem wrote:unable to mark the property with the "IsVersion()" tag
Code: Select all
builder.Entity<Class1>()
.Property(p => p.Property2)
.NotNullable().IsRowVersion()
.ServerDataType(@"varbinary(MAX) NOT NULL");
Unfortunately, there is no such possibility. You can add properties of the primitive types and make all the necessary conversions in getters/setters.unclelem wrote:Is there any way via mapping (e.g. by means of a lambda expression) to map the data being stored/retrieved other than implementing a hidden member and using custom accessors.
Re: fluent versioning and type mapping help, please
Then, using the fluent method, how do you associate this with an integer, long or datetime column so that it can be updated on a trigger, as is done with the annotational method in the documentation example? Or are you saying that this is not possible with the fluent method?MariiaI wrote:There is .IsRowVersion() method when working with the fluent mapping approach, however, it is available only for the binary properties. For example:
CODE: SELECT ALL
builder.Entity<Class1>()
.Property(p => p.Property2)
.NotNullable().IsRowVersion()
.ServerDataType(@"varbinary(MAX) NOT NULL");
e.g. What is the fluent equivalent of
[Column(Name = "RowVersion", CanBeNull= false, IsVersion = true, DbType = "BIGINT(22) NOT NULL", AutoSync = always, DbGenerated = true)]
public long RowVersion {get; set;};
Re: fluent versioning and type mapping help, please
Unfortunately, there is no such possibility for now. However, we will implement this functionality and inform you about the results as soon as possible.unclelem wrote:Then, using the fluent method, how do you associate this with an integer, long or datetime column so that it can be updated on a trigger, as is done with the annotational method in the documentation example?
Some useful information:
https://www.devart.com/linqconnect/docs ... ation.html
https://www.devart.com/linqconnect/docs ... pping.html
Please also try using this code:
Code: Select all
var property = builder
.Entity<MyClass>()
.Property(e => e.RowVersion);
((IPropertyConfiguration)property).IsRowVersion = true;
Re: fluent versioning and type mapping help, please
Thank you for the quick assistance. I will try that as soon as I can.
Is it possible to mix both fluent and annotational methods? e.g. define some properties as annotations in the class, and then supplement them programmatically using fluent methodology? Or define some classes annotationally, and others using fluent methodology?
Is it possible to mix both fluent and annotational methods? e.g. define some properties as annotations in the class, and then supplement them programmatically using fluent methodology? Or define some classes annotationally, and others using fluent methodology?
Re: fluent versioning and type mapping help, please
It is not supported in LinqConnect directly. However, you can implement this via fluent mapping conventions:Is it possible to mix both fluent and annotational methods?
https://www.devart.com/linqconnect/docs ... tions.html
https://www.devart.com/linqconnect/docs ... tions.html
We are sending you a small sample project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
The sample shows a simple way to implement this, you can modify and extend it in the way, that is suitable for your scenario.
We have implemented this functionality. The changes will be available in the next public build of LinqConnect which we plan to release soon. We will post here when the corresponding build is available for download.Then, using the fluent method, how do you associate this with an integer, long or datetime column so that it can be updated on a trigger, as is done with the annotational method in the documentation example?
Re: fluent versioning and type mapping help, please
Thank you, this is all very helpful.
Re: fluent versioning and type mapping help, please
The possibility to use .IsRowVersion() method for properties with non-binary data types when using the fluent mapping approach is added.
New build of LinqConnect 4.5.816 is available!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=32325.
New build of LinqConnect 4.5.816 is available!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=32325.
Re: fluent versioning and type mapping help, please
Could you please send me the example project that demonstrates how to mix fluent mapping with attribute-annotation mapping? Thanks. Some of my entities are mapped with attribute-annotations, some other entities are mapped with fluent.
Re: fluent versioning and type mapping help, please
We've sent you a small sample project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
The sample shows a simple way to implement mixed approach, you can modify and extend it in the way, that is suitable for your scenario.
The sample shows a simple way to implement mixed approach, you can modify and extend it in the way, that is suitable for your scenario.