Page 1 of 1

Use custom AttributeMappingSource

Posted: Mon 31 Aug 2009 13:28
by vpant
Hello,

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?

Posted: Thu 03 Sep 2009 09:21
by AndreyR
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.