• Register
0 votes
1.3k views

Problem :

I am having the table with the name EducationTypes and also an Entity named as EducationType, I just tried to rename the one of the entity properties but now I am always facing following error :

Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong. How can I fix the above mentioned error?

The generated SQL Script is as below:

EXECUTE sp_rename @objname = N'dbo.EducationTypes.nvarchar', @newname = N'EducationTypeTitle', @objtype = N'COLUMN'

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I think this is happening because of the name Conflict of Class (Model) names with the other reserved or the generated ones, but when auto creates the tables and Considering that EF Code First creates the intervene tables to relate the two or more of the tables using name of the tables for derived intervene table, so when you use the class name that employs a name like the intervene tables, we will get as such this ambiguous error.

e.g. If you have the Question class which has the navigation property with the name Answer  then the internal model metadata will contain the reference called QUESTION_ANSWER

To resolve this, just try to change the class names which are used for generating tables and ensure that they are unique.

38.6k points

Related questions

0 votes
1 answer 12 views
12 views
Problem: Entity framework many to many code first
asked Jul 18 Chi Omega 168k points
0 votes
1 answer 11 views
11 views
Problem: Entity framework code first many to many
asked Jul 18 Chi Omega 168k points
0 votes
1 answer 39 views
39 views
Solution: need someone to understand this problem and find out the solution. May cause cycles or multiple cascade paths
asked May 19 Ifra 43.4k points
0 votes
1 answer 10 views
10 views
Problem: Does EF Core 3.1 support DB First approach? If not, what are the options? Are we left with only code first approach?
asked Jun 2 Irenka Kiri 85.5k points
0 votes
1 answer 17 views
17 views
Problem: Try to discover this : Code first vs database first entity framework
asked May 29 Chi Omega 168k points
0 votes
1 answer 25 views
25 views
Problem: What is wrong here: Could not determine storage version; a valid storage connection or a version hint is required.?
asked Jun 10 Sawyer Parviz 167k points
0 votes
1 answer 28 views
28 views
Problem: Can anyone tell me the solution : Validation failed for one or more entities. see 'entityvalidationerrors' property for more details.?
asked Jun 10 Priscilla Gurpreet 74.7k points
1 vote
1 answer 37 views
37 views
Problem: Need help with the usage of entities , I am facing this issue. The entity or complex type cannot be constructed in a linq to entities query.
asked Mar 26 PkGuy 25.9k points
0 votes
1 answer 32 views
32 views
Problem: I am stuck with this ... Please help me that how to deal with this error?Could not load file or assembly mysql data
asked Mar 21 Ifra 43.4k points
0 votes
1 answer 181 views
181 views
Problem : I have one entity type called product which is generated by the entity framework. I have tried to write below query public IMyQueryable<Product> GetProducts(int myCategoryID) {     return from prod in db.Products     where prod.CategoryID== myCategoryID     select ... one select new Product { Name = p.Name}; it miraculously works correctly. How can I perform the custom select section?
asked Jan 27, 2020 jwilliam 3.9k points