Use custom AttributeMappingSource

Use custom AttributeMappingSource

Postby vpant » Mon 31 Aug 2009 13:28


I'm using the latest version of dotConnect for Oracle and I'm trying to figure out a way to use dynamic table names on existing classes. One example I found was the use of a custom attribute mapping source. The example creates a set of wrapper classes for MappingSource, MetaModel and MetaTable classes in Linq and gives you the ability to change the table name that is declared on the TableAttribute of your class.

Unfortunately it seems that this example does not apply for the dotConnect mapping. When i use these wrapper classes and try to instantiate the datacontext, I get an InvalidCastException that says that my custom MetaModel cannot be cast to a Devart.Data.Linq.MappingSource.d class.

Any ideas how I can implement something like that?
Posts: 2
Joined: Mon 31 Aug 2009 13:19

Postby AndreyR » Thu 03 Sep 2009 09:21

The approach you describe contains some vulnerabilities. We do not plan to enable the runtime schema changing.
As an alternative, I recommend you to use XmlMappingSource attribute, we plan to support it in the upcoming build.
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Return to LinqConnect (LINQ to SQL support)