共 17 篇文章 |
|
CREATE TABLE [AccountTypes] ( [AccountTypeID] [uniqueidentifier] NOT NULL , [AccountTypeName] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL , CONSTRAINT [PK_AccountTypes] PRIMARY KEY CLUSTERED ( [AccountTypeID] ) ON [PRIMARY] ) ON [PRIMARY]GO. 阅220 转0 评0 公众公开 14-06-15 21:17 |
跟我学MVC系列(Repository模式、LINQ、EF、IOC框架Castle、JQuery、AJAX)(五)Models(ORM、Repository模式、分页)现在是凌晨12点半拉,夜深人静,趁我还没有睡意,现在继续。代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using PBAccount.Repository;using PBAccount.Models;void Updat... 阅131 转0 评0 公众公开 14-06-15 21:11 |
跟我学MVC系列(Repository模式、LINQ、EF、IOC框架Castle、JQuery、AJAX)(四)Models(ORM、Repository模式、分页)现在提醒你一下啊,我们在Models下面定义了三个实体类接口(IAccount.cs IAccountType.cs IUser.cs )呢,下面我们用EF来对它们实现,你就会发现EF的魅力啦,代码如下啊:我们在Repository文件夹下新建了一个Helper文件夹,... 阅150 转0 评0 公众公开 14-06-15 21:10 |
/// <summary> /// 构造函数 /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <param name="field"></param> public CriteriaParameter(string name, object value, string ... 阅647 转0 评0 公众公开 14-06-15 21:08 |
/// <summary> /// 拍戏类 /// </summary> public class Order { public OrderType OrderType { get; set; } /// <summary> /// 排序的字段 /// </summary> public string[] Fields { get; set; } public Order(OrderType orderType, params string[] fields) ... 阅135 转0 评0 公众公开 14-06-15 20:44 |
Repository模式。public class Repository<T> : IRepository<T> where T : class{ public DataContext context;public Repository(DataContext context) { this.context = context;} public void Save() { context.public class BookRepository : Repository<Book>, IBookRepository{ public BookRepository(DataContext dc)... 阅159 转0 评0 公众公开 14-06-15 20:43 |
跟我学MVC系列(Repository模式、LINQ、EF、IOC框架Castle、JQuery、AJAX)(二)Models(ORM)在《企业架构模式》中,译者将Repository翻译为资源库。,然后,在“Repository”文件夹下面添加“ADO.NET Entity Data Model”,我们命名为“AccountEDM”,然后选择“从数据库生成”,把我们建立的三个表全选,系统就自动生成了一个EF,如下图:这一... 阅159 转0 评0 公众公开 14-06-04 23:30 |
七、分组操作符分组操作符GroupBy用来按照元素的某个属性来对序列中的元素进行分组。(一)Count取得序列中满足条件的元素的个数使用扩展方法:var q = infos.Count(p => p.Sex == false);var q = infos.Where(p => p.Sex == false).Count();使用查询表达式语法:var q = (from p in infos where p.Sex==false select p).Count();(二)M... 阅36 转0 评0 公众公开 14-06-04 23:18 |
}} 实例化LineItem对象,并为它赋值var line3 = new LineItem { OrderID = 11000, ProductID = 61, Quantity = 30, QuantityPerUnit = “12 1-kg cartons”, UnitPrice = 15.55M, Discount = 0.15F };匿名类型主要用在LinQ to SQL中对字段的投影功能上:var query = from i in LineItems select new { i.OrderID, i.ProductID, i.UnitPrice }La... 阅31 转0 评0 公众公开 14-06-04 23:07 |
使用Moq让单元测试变得更简单 前几天调查完了unity。Moq(英语发音是Mock-you 或者只是mock)是一个针对.Net开发的模拟库,它从开始就完全充分利用了.NET3.5(LINQ表达式树)和C#3.0的新特性(lambda表达式)。否则,我们可以从http://code.google.com/p/moq/这里得到Moq的最新版本。因为Moq只能创建模拟对象实例。Moq原理 Moq是如何办到... 阅1336 转1 评0 公众公开 14-06-04 22:40 |