class Role(db.Model): __tablename__='roles' id = db.Column(db.Integer,primary_key=True) name = db.Column(db.String(64),unique=True) users = db.relationship('User',backref='role') def __repr__(self): return '<Role %r>'% self.name class User(db.Model)
今天准备说说EntityFramework 6.0+,它与我之前所学的4.0有所区别,自从4.1发布以来,code first 被许多人所钟爱,Dbcontext API也由此时而生.早在学校的时候就听老师说过Db first,Model first 和 Code first , 没怎么去注意,最近我直接从Db first 跳到了 Code first,去了解了下,个人觉得Model first 和 Code first 没多大区别,英文好的人看以看看http://stackoverflow.c
参考:http://blog.csdn.net/sxycxwb/article/details/12186159 0.删除之前的数据库 1.Run the Enable-Migrations command in Package Manager Console 进入(PM)软件包管理控制台 (视图——>其他窗口——>程序包管理控制台)输入以下指令:Enable-Migrations 会提示:"No context type was found in the assembly"