<分区>
我试图通过使用 Entity Framework 从数据库中获取一些值
我有疑问
Difference between
new ClassName
andnew ClassName()
in entity framewrok query
代码1
dbContext.StatusTypes.Select(s => new StatusTypeModel() { StatusTypeId =
s.StatusTypeId, StatusTypeName = s.StatusTypeName }).ToList();
代码2
dbContext.StatusTypes.Select(s => new StatusTypeModel { StatusTypeId =
s.StatusTypeId, StatusTypeName = s.StatusTypeName }).ToList();
您可以从我创建 new StatusTypeModel
和 new StatusTypeModel()
对象的位置看到更改。
- The both queries are working for me. but i don't know the differences between of code 1 and code 2 .