c# - How to add new table in context ASP.NET MVC -


please, me. had file imagecontext:

using system; using system.collections.generic; using system.linq; using system.web; using system.data.entity;  namespace usergallery.models {     public class imagecontext : dbcontext     {         public dbset<image> images { get; set; }     } } 

i create new model slide , add string connect in imagecontext. result

... public class imagecontext : dbcontext     {         public dbset<image> images { get; set; }         public dbset<slide> slides { get; set; }     } ... 

how update database create table slides?

screenshoot database table: enter image description here

if have automatic migrations set should pretty straight forward.

if haven't, need run

enable-migrations –enableautomaticmigrations 

perhaps further reading here first though: http://msdn.microsoft.com/en-gb/data/jj554735.aspx

  1. create new migration addition of slides

    add-migration "slidemigration"

  2. now update... , should work.

    update-database


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -