简体   繁体   中英

Data First EF, System Table clashes with System Namespace

I'm developing a .NET project and am incorporating a data-first link with a database. Unfortunately, the database has a mandatory table called "System", and the generated class in the model is clashing with the System namespace, overriding it. I have tried commenting out the class and all references to it, but then the Context throws missing relationship errors. Any ideas on resolving this conflict?

I am new to data-first EF, so I'm sure there must be some work around I'm not familiar with. Perhaps renaming the class and all its references within the class, but mapping it to the correct table in the context/edmx? I'm not sure how to do that though. I'm using EF 6.2.

You can change the name in the EDMX designer. That will rename the class and keep it mapped to the System table. – Gert Arnold

This was the correct answer. Intellisense didn't volunteer to fix the class names for me after renaming in the EDMX, so I had to spend 15 minutes updating the class, its references, and the 20ish times it was referenced in the EDMX file itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM