This question is locked. New answers and comments are not allowed.
In my model a have a few transient properties which I can mark as follows
configuration.HasProperty( x => x.CalculatedProp).AsTransient();
But if property is of type DateTime it is not possible, because DateTimePropertyConfiguration does not have a function AsTransient().
How could I define a DateTime property as transient?
Is it possible to ignore properties which are not explicitly mapped or automatically mark them as transient?
Regards,
Markus
configuration.HasProperty( x => x.CalculatedProp).AsTransient();
But if property is of type DateTime it is not possible, because DateTimePropertyConfiguration does not have a function AsTransient().
How could I define a DateTime property as transient?
Is it possible to ignore properties which are not explicitly mapped or automatically mark them as transient?
Regards,
Markus
5 Answers, 1 is accepted
0
Hello Markus,
Only the Id,Name,Discontinued and CategoryId properties will receive default mapping unless other is not specified. All properties that are not mentioned in this lambda expression and do not have an explicit mapping provided with the HasProperty method will be regarded as transient.
The last possibility is to use this method with an empty lambda like this:
This would mean that no properties will receive default mapping and all will be considered to be transient unless explicit mapping is provided via the HasPropertyMethod.
I hope this was helpful to you. All the best,
Petar
the Telerik team
It is possible to achieve that using the .MapType() method. Whenever you use the MapType method without specifying a lambda expression this would instruct our metadata reader that all properties in that types will be default mapped if no explicit mapping is specified.
If you however use a method like this:
productConfiguration.MapType(p => new { ProductId = p.Id, ProductName = p.Name, Discontinued = p.Discontinued, CategoryId = p.CategoryId }).ToTable("Products");The last possibility is to use this method with an empty lambda like this:
productConfiguration.MapType(x => new { }).ToTable("Product");I hope this was helpful to you. All the best,
Petar
the Telerik team
Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Trevor
Top achievements
Rank 1
answered on 15 Apr 2013, 04:57 PM
Can I use the default mapping, and still specify a DateTime as Transient?
0
Hi Trevor,
Petar
the Telerik team
With the latest release of OpenAccess it is possible to specify .AsTransient() on properties of type DateTime.
Regards,Petar
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
0
Trevor
Top achievements
Rank 1
answered on 16 Apr 2013, 09:31 PM
We have version 2013.1.219.3 and I am unable to specify AsTransient() on any DateTime properties. If I add the AsTransient() to my configuration, it says "Cannot resolve symbol 'AsTransient".
It does, however, let me specify other types as Transient.
Is there something else I'm missing here?
It does, however, let me specify other types as Transient.
Is there something else I'm missing here?
0
Hello Trevor,
Petar
the Telerik team
The version you are using is not our latest internal build. You should be able to see the internal build under your downloads if you have downloaded the Q1 release from 2013 through our site.
All the best,Petar
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>