Wednesday, May 11, 2016

Re-generating an ADO.NET Entity Data Model from the database

I recently had to change my underlying database schema and therefore needed to update my Entity Framework Data Model.

Unfortunately, just updating the data model directly caused problems with column mappings, so I ended up having to regenerate the ADO.NET Entity Data Model.

Going through the Visual Studio Entity Data Model wizard went through just fine, however, because of the structure of the project/solution, I quickly discovered that I could not name my entity class the same name as before!

Instead, my class name was showing up as "Entities" instead of my original class name!

Well, thankfully, changing the name of the class was relatively easy by simply modifying the <EFModel>.Context.cs class file.



public partial class Entities: DbContext
{
        public Entities()
            : base("name=Entities")
        {
        }
}

I then simply changed this to match my Entities class name as follows:


public partial class MyCustomEntities: DbContext
{
        public MyCustomEntities()
            : base("name=MyCustomEntities")
        {
        }
}

Now I could work with my Entity Framework classes just as before!!

24 comments:


  1. NICE for giving a chance to share ideas for your comuty i really thanks for that great post.Deer Hunting Tips Camping Trips Guide DEER HUNTING TIPS travel touring tips

    ReplyDelete

  2. Excellent blog with very informative information and knowledgeable Content thank you.
    typeerror nonetype object is not subscriptable

    ReplyDelete
  3. Awesome blog with excellent information, I really enjoyed it waiting for next blog update thank you.
    Data Science Training in Hyderabad

    ReplyDelete

  4. I think I have never seen such blogs before that have completed things with all the details which I want. So kindly update this ever for us.
    Digital Marketing Course

    ReplyDelete
  5. Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you!
    data scientist course in hyderabad

    ReplyDelete
  6. Nice blog post,
    SEO Training In Hyderabad
    SEO stands for search engine optimization. It is the process of ranking your website at the top of the search results for a particular set of keywords. SEO experts will try to rank a specific page on the top of the search results. SEO can increase your brand’s visibility, thus creating brand awareness.

    ReplyDelete
  7. I really enjoy reading all of your blogs. I just wanted to let you know that you have people like me who appreciate your work. Definitely a great article. Congratulations! The information you have provided is very helpful.
    Business Analytics Course

    ReplyDelete
  8. The Extraordinary blog went amazed with the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Machine Learning Course in Bangalore


    ReplyDelete
  9. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
    best data science institute in hyderabad


    ReplyDelete
  10. here is a good blog for those who want to know more about digital marketing Digital professionals

    ReplyDelete
  11. real estate in dubai https://dubayt.com/property/act-one-act-two/

    ReplyDelete
  12. With so many books and articles appearing to usher in the field of making money online and further confusing the reader on the real way to make money.

    Business Analytics Course

    ReplyDelete
  13. Wonderful illustrated information. Thank you. It will certainly be very useful for my future projects. I would love to see more articles on the same topic!

    Data Science Training in Bangalore

    ReplyDelete
  14. Really an awesome blog and informative content. Thanks for sharing with us. If you want to become a data scientist, then check out the following link.
    Online Data Science Courses in Hyderabad

    ReplyDelete
  15. Get the best Data Science online course at the comfort of your home. Flexible timings, Best industry trainers, and meticulously crafted curriculum.data science training in kolkata

    ReplyDelete
  16. Explore what the best Data Science training institute is offering you. Learn advanced technologies from the best industry experts.

    ReplyDelete
  17. Explore what the best Data Science training institute is offering you. Learn advanced technologies from the best industry experts.

    data analytics course in lucknow

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Embark on a journey to achieve your professional goals by enrolling in the Data Scientist course in Bangalore. Learn the skills of collecting, extracting, analyzing, preparing, visualizing, and presenting results to make valuable decisions. Master the concepts of data science through hands-on projects and case studies to learn the latest trends and skills in this field.


    Data Science in Bangalore

    ReplyDelete
  20. I want to thank you for your time in this wonderful read which is really appreciable and put you in your favorites to see new things on your blog, a must-have blog!
    Business Analytics Course in Noida

    ReplyDelete
  21. Learn the fundamentals of Data Science and master the skills to handle epic amounts of data collected by organizations today. Gain expertise in organizing, analyzing, and transforming data to uncover its hidden power. Drive your career forward with a Data Science course in Bangalore and learn to uncover insights to present critical findings using visualization tools. Not only this, avail the best-in-class content delivered by stellar faculty who use a blended approach of theory as well as practical knowledge to ensure all the concepts are crystal clear.

    Data Science Course in Bangalore with Placement

    ReplyDelete
  22. Start your career preparation with the best Data Science courses offered by 360DigiTMG. A world-class curriculum, LMS Access, assignments, and real-time project to grab a high-paying job.

    Business Analytics Course in Jodhpur

    ReplyDelete