Pages

Tuesday, December 18, 2018

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

In my MVC app, I followed the OLD ASP.net roleManager and MembershipManager setup.

DO NOT DO THIS WITH MVC!

DO NOT RUN ASPNET_REGSQL!

Identity does NOT work that way anymore.

What I had to do was remove the line in my web.config that said:

    <roleManager enabled="true" cacheRolesInCookie="false"  />
Once I got rid of that, the error blessedly poofed into a memory.


...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, December 7, 2018

Updating Object Relational Model Easily in MVC

So I got my mind around the models, if I change a field, I know how to modify the object properties to match.  Ditto the relationships - add a hashset here and there to reference linked items.
But I read the ORM (the main model page) and that thing just mystifies me.
Like this:

So a PrefCategory has many Prefs. got it.
But it has a required PrefCategory???  It requires itself? 

Anyhow, Applying the American credo just get it done, I came up with this:
To complete this tutorial you will need WinMerge.
First open up your relational mode in Models.  Copy all the text.

Open WinMerge, hit the 2 pages icon to create a new comparison,  and paste the code into the left pane.
Now in Visual Studio, create a new MVC project.  in Solution Explorer, right click Models - Add - Ado.Net Entity Model.
Choose your development database, and tick all the same tables and views you are using in your main app.
It will create all the table models.
Now open the same relational model, copy all and paste it into the right pane of WinMerge.  Hit Refresh.
Now you'll see everywhere that your code differs from what you'd see if you imported the model fresh.
In my case, I could easily see where I had an old .WithOptional that had now become a .WithRequired.  I modified my project relational model and suddenly I was no longer getting the

Multiplicity conflicts with the referential constraint in Role 'blah blah thing that doesn't exist by that name anywhere in the project' in relationship 'blah blah'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'.
errors.


Share This!

Contact Us

Name

Email *

Message *