• Register
0 votes
703 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'

6 5 3
7,540 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 82 views
82 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
0 votes
2 answers 301 views
301 views
Problem : Currently I am migrating from the Identity 1.0.0 to Identity 2.0.1. But the migrations code generated is nothing about the new IdentityUser. And It does not even add the new columns. So I tried to make the new project and also I ... current context At below line IdentityResult result = await UserManager.CreateAsync(user, model.Password); Any clue about the solution on my above problem?
asked Dec 25, 2019 alecxe 7.5k points
0 votes
1 answer 75 views
75 views
Problem : My Query is giving the strange error as follows there is already an open datareader associated with this command which must be closed first.
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 111 views
111 views
Problem : I am getting bellow error related to datetime the conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
asked Nov 7, 2019 peterlaw 6.9k points
0 votes
1 answer 13 views
13 views
How can i apply any entity framework approach like code first and database first in the ASP.NET MVC application.
asked Sep 16, 2020 Daniel Anderson 4k points
0 votes
1 answer 28 views
28 views
Problem: Currently I have the table called Student in the database with some of the values and I am trying to display the values in the webgrid with the help of entityframework. I have done exactly the same kind of work before many times using the Ado.net, but ... I assign the VAR value to List also is this my correct approach? Kindly guide me in fixing my problem related to Entity Framework.
asked Jul 3, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 116 views
116 views
Problem : I am facing following c# socket issue the i/o operation has been aborted because of either a thread exit or an application request
asked Nov 16, 2019 peterlaw 6.9k points
0 votes
1 answer 11 views
11 views
Problem: I am a new programmer and I have recently installed the Visual Studio 2019 Community version. I have written only two programs in C# till now. Today, I created a new solution but I wanted to copy the code from previous solutions. So, when I tried opening the ... other solution. I do not know whether the problem is in my solutions or the Visual Studio? How can I resolve this? Please help.
asked Dec 4, 2020 Code Learner 5.5k points
0 votes
2 answers 329 views
329 views
Problem : I am facing below error while trying to compile my code of C# in visual Studio 2015. &ldquo;There is no argument given that corresponds to the required formal parameter&rdquo;
asked Jan 22, 2020 jwilliam 3.9k points
1 vote
2 answers 404 views
404 views
Anyone aware of this error. I am facing this issue in this function. It is not going to IF statement where I put my filter condition which is true then simply raise Error and without IF it is working but I want to put the filter condition which checks date between ... "value"]) It is not going to IF statement where I put my filter condition which is true then simply raise Error. Any suggestion?
asked May 8, 2020 Kashish