locked
Error which was not an error before changing my model RRS feed

  • Question

  • User-326746839 posted

    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) 

     

    Friday, December 14, 2012 3:12 PM

Answers

  • User-326746839 posted

    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) 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2012 11:41 AM

All replies

  • User-330204900 posted

    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 :)

    Friday, December 14, 2012 5:42 PM
  • User3866881 posted

    Error 1 No defining declaration found for implementing declaration of partial method 'CascadeHierarchicalSample.CarlosTestEntities.OnContextCreated()'
    C:\MyProjs\CascadeHierarchicalSample\CarlosTestModelExtension.cs 30 22 CascadeHierarchicalSample

    Hi,

    What have you done?

    What entity model have you got?

    What actually do you wanna do?

    Saturday, December 15, 2012 3:18 AM
  • User-326746839 posted

    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) 

    Monday, December 17, 2012 10:30 AM
  • User3866881 posted

    Until I added a field (an extra column) to one of my entities in my model.

    Have you sychronizedly add that in your real datatable?

    Monday, December 17, 2012 8:25 PM
  • User-326746839 posted

    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) 

    Tuesday, December 18, 2012 12:14 AM
  • User3866881 posted

    Hi again,

    If you delete your edmx file and re-create again to see what's happening?

    Notice please back up your original one;)

    Tuesday, December 18, 2012 12:27 AM
  • User-326746839 posted

    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) 

    Tuesday, December 18, 2012 9:43 AM
  • User-326746839 posted

    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) 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2012 11:41 AM