开发者

Can a datacontext load objects from a different namespace

开发者 https://www.devze.com 2023-03-12 21:57 出处:网络
We are migrating from an ugly persistence framework (custom, that probably looked cool at the time) The problem is that the objects are related using a relations table ( yes, no foreign keys only ite

We are migrating from an ugly persistence framework (custom, that probably looked cool at the time)

The problem is that the objects are related using a relations table ( yes, no foreign keys only item id's)

The database has been migrated to a relation structure with foreign keys and all.

The problem is migrating the code to Entity Framework, we would like to impact to a minimum the UI, but our objects are in 开发者_Go百科different namespace like : Catalog, Catalog.Products, Catalog.Asset, etc ...

We wanted to generate the Catalog.cs , from the .edmx, and use the generated classes to modify the old classes (to be able to be used by EF).

Can the DataContext created , load objects from diffent namespaces ?

I did create a class with the proper attibutes , but got rewarded with :

Mapping and metadata information could not be found for EntityType

Then I added the ObjectSet to the Catalog.cs, but got rewarded with :

The EntitySet name 'CatalogEntities.ProductTests' could not be found

, the 'CatalogEntities.' part was added at run time, this is why I suspect that it cannot be done.

Can anyone shed some light on whether it's possible or not, this would prevent us from changing a lot of namespaces?


The simple answer is NO

you can't load objects from different namespaces in a single Context

0

精彩评论

暂无评论...
验证码 换一张
取 消