Is so funny. I had my project working just fine and suddnely I refreshed the model because I added an extra column to one of my tables and now I got an error message that wasn't there before
Error 1 No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()'
C:\MyProjs\CascadeHierarchicalSample\CarlosTestModelExtension.cs 30 22 CascadeHierarchicalSample
Hi Carlos, I usually work out which entity is the isseu then delete from the model and re-add that usually fixed issues like that for me. you can also ask in the EF forum that will obviously know more :)
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Error 1 No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()'
C:\MyProjs\CascadeHierarchicalSample\CarlosTestModelExtension.cs 30 22 CascadeHierarchicalSample
I did nothing serious at all. I had this application running perfectly ok. Compiled 100%, ran and did everything ok.
I ALREADY HAD the DBAudit stuff suggested by Steve Naughton working so there was no problem. I had the system updating that additional table also. The xml fields recorded in a very 100% perfect way all CRUD operations in the database.
I HAD NO PROBLEMS AT ALL WITTH ALL OF THAT : Cascading was working fine MetaData validiation was doing its job perfectly, DBAUdit was running pretty fine ...
Until I added a field (an extra column) to one of my entities in my model.
I ran the option update model from database (having of course elimitaed the entity I was going to replace from my diagram first) and after that I got the error
I just added an extra column to one of my tables ... nothing more than that .... !!!
I use a CASE tool for managing my designs so I got the script directly from there and then I run the SQL script in my SQL Server databaase.
At that very moment, my database is created from scratch everytime I make a change so I need to go to my VS2012 GUI in which I must update my model from database directly. So I select all entities in my .edmx model I SELECTE THEM ALL AND THEN I ERASE ALL
OF THEM FROM MY DRAWING. After that, I run the update option.
In order to avoid confusion, I also avoid Metadata additional files so no problem arise going that way becaus I simply don't even go there !
In a few words: I updated my CASE model, I generated a new sql script for regenerating my datab<ase. I ran that scrtipt in my SQL Server (the database was aupdated with the newly inserted column) and then I updated my VS2012 model directly from my database
It's so funny ... it happens just by moving from its place any entity in the model ....
Error1No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()'Q:\xxx\yyy\zzz\aaaa\bbb\CarlosTestModelExtension.cs3022
CascadeHierarchicalSample
I solved it ain a very rudimentary way. I saw the code which was working. Copied all the automatically generated ddesigner class (the context region) and then I updated the model.
I added the new class to the project with the previous contexts that weren't there now (missing for unknown reason) and now it's working
Member
242 Points
480 Posts
Error which was not an error before changing my model
Dec 14, 2012 03:12 PM|klca|LINK
Hi,
Is so funny. I had my project working just fine and suddnely I refreshed the model because I added an extra column to one of my tables and now I got an error message that wasn't there before
Error 1 No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()'
C:\MyProjs\CascadeHierarchicalSample\CarlosTestModelExtension.cs 30 22 CascadeHierarchicalSample
It wasn't there before refreshing my model !!!!
Carlos N. Porras
(El Salvador)
All-Star
17916 Points
5681 Posts
MVP
Re: Error which was not an error before changing my model
Dec 14, 2012 05:42 PM|sjnaughton|LINK
Hi Carlos, I usually work out which entity is the isseu then delete from the model and re-add that usually fixed issues like that for me. you can also ask in the EF forum that will obviously know more :)
Always seeking an elegant solution.
All-Star
94130 Points
18109 Posts
Re: Error which was not an error before changing my model
Dec 15, 2012 03:18 AM|Decker Dong - MSFT|LINK
Hi,
What have you done?
What entity model have you got?
What actually do you wanna do?
Member
242 Points
480 Posts
Re: Error which was not an error before changing my model
Dec 17, 2012 10:30 AM|klca|LINK
Hi Mr. Dong,
I did nothing serious at all. I had this application running perfectly ok. Compiled 100%, ran and did everything ok.
I ALREADY HAD the DBAudit stuff suggested by Steve Naughton working so there was no problem. I had the system updating that additional table also. The xml fields recorded in a very 100% perfect way all CRUD operations in the database.
I HAD NO PROBLEMS AT ALL WITTH ALL OF THAT : Cascading was working fine MetaData validiation was doing its job perfectly, DBAUdit was running pretty fine ...
Until I added a field (an extra column) to one of my entities in my model.
I ran the option update model from database (having of course elimitaed the entity I was going to replace from my diagram first) and after that I got the error
I just added an extra column to one of my tables ... nothing more than that .... !!!
Carlos N. Porras
(El salvador)
All-Star
94130 Points
18109 Posts
Re: Error which was not an error before changing my model
Dec 17, 2012 08:25 PM|Decker Dong - MSFT|LINK
Have you sychronizedly add that in your real datatable?
Member
242 Points
480 Posts
Re: Error which was not an error before changing my model
Dec 18, 2012 12:14 AM|klca|LINK
Hi Mr. Dong,
I use a CASE tool for managing my designs so I got the script directly from there and then I run the SQL script in my SQL Server databaase.
At that very moment, my database is created from scratch everytime I make a change so I need to go to my VS2012 GUI in which I must update my model from database directly. So I select all entities in my .edmx model I SELECTE THEM ALL AND THEN I ERASE ALL OF THEM FROM MY DRAWING. After that, I run the update option.
In order to avoid confusion, I also avoid Metadata additional files so no problem arise going that way becaus I simply don't even go there !
In a few words: I updated my CASE model, I generated a new sql script for regenerating my datab<ase. I ran that scrtipt in my SQL Server (the database was aupdated with the newly inserted column) and then I updated my VS2012 model directly from my database
Carlos N. Porras
(El Salvador)
All-Star
94130 Points
18109 Posts
Re: Error which was not an error before changing my model
Dec 18, 2012 12:27 AM|Decker Dong - MSFT|LINK
Hi again,
If you delete your edmx file and re-create again to see what's happening?
Notice please back up your original one;)
Member
242 Points
480 Posts
Re: Error which was not an error before changing my model
Dec 18, 2012 09:43 AM|klca|LINK
Hi,
It's so funny ... it happens just by moving from its place any entity in the model ....
Error 1 No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()' Q:\xxx\yyy\zzz\aaaa\bbb\CarlosTestModelExtension.cs 30 22 CascadeHierarchicalSample
Carlos N. Porras
(El Salvador)
Member
242 Points
480 Posts
Re: Error which was not an error before changing my model
Dec 18, 2012 11:41 AM|klca|LINK
Hi Mr. Dong,
I solved it ain a very rudimentary way. I saw the code which was working. Copied all the automatically generated ddesigner class (the context region) and then I updated the model.
I added the new class to the project with the previous contexts that weren't there now (missing for unknown reason) and now it's working
Carlos N. Porras
(El Salvador)