1.首先推荐 网易云课堂上的一个付费课程:常老师带你学ASP.NET MVC ,价格199元
2. 一个.net的框架,ABP,中文介绍如下 http://www.cnblogs.com/farb/p/ABPTheory.html
3.经常遇到的ajax跨域请求的资源共享问题,参见这里http://www.ruanyifeng.com/blog/2016/04/cors.html
3 entityframework 的 数据库更新命令 https://www.cnblogs.com/panchunting/p/entity-framework-code-first-migrations.html
4.entityframework 必须知道的 fluent api 使用方法 https://www.cnblogs.com/caofangsheng/p/5715876.html
这里我想说一下自己的心得,entity framework 有一定的智能,可以创建表与表之间的关联关系。
比如:
下面这个一对多关系
public class Proposal : AggregateRoot<int> { public virtual List<ServiceType> ServiceTypes { get; set; } } public class ServiceType : Entity<long> { public virtual string Name { get; set; } }
系统会自动向 servicetype表中,加入外键 Proposal_Id列,完成关联,调用proposal.ServiceTypes 是没问题的。
但是下面这个就不行,不能调用proposal.requestor 会提示缺少外键关联:
public class Proposal : AggregateRoot<int> { [ForeignKey("Requestor_Id")] //没有这个关联,proposal.requestor 就会出错 public virtual User Requestor { get; set; } } public class User : AggregateRoot<int> { public virtual string Name { get; set; } }
其实,这是一个一对多关系,一个user对应多个proposal,系统也会自动在Proposal表中加入 Requestor_Id 外键,去关联user。但是系统没有将
Requestor属性和 Requestor_Id 外键 自动对应,需要我们手动对应,加入map。
我觉得,在使用List等集合的时候,可以不做处理,但是如果直接使用其他数据库对象类型作为属性,就要进行手动的map操作,比如这里的 requestor。
原因不是特别明白,等研究一下文档。