Search code examples
asp.net-mvcpiranha-cms

Piranha CMS - Entity Framework Context


I got my feet wet with using Piranha CMS for a small site. One point I am not sure how to handle is extending the DB and CMS model for site data.

For example, visitors fill out a form and I capture their info. With EF I have created the class and added the dataset to the context then updated the DB via CodeFirst.

What is the suggested method? Create a 2nd context for the site data?


Solution

  • If you want to use code first you should store your site data in it's own context. Otherwise there will be a conflict when your extended context tries to create the CMS tables as well.

    In future releases the Piranha DataContext will most likely be sealed to avoid confusion.