上一页 1 ··· 342 343 344 345 346 347 348 349 350 ··· 380 下一页
摘要: 注意,在使用datacontext对象时,它会产生数据缓存,也就是为了提高读取数据速度,它会将数据库对象进行缓存,或者返回为IQueryable结果集,使数据查询结果持续到需要得到数据的时间才去真正的select 动作。如果希望datacontext对象每次取数据时,都从数据库中得到数据,即select操作,可以这样: this._db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, entity);注意,这里的entity是一个实体,即当进行数据库更新操作时,希望datacontext 得到最新更新的数据,可以用上面语 阅读全文
posted @ 2011-11-15 03:47 张占岭 阅读(821) 评论(3) 推荐(0)
摘要: DECLARE @c INTDECLARE @c2 INTSELECT @c = COUNT(1)FROM dbo.SplitToTable('1|2|3|4', '|') SELECT @c2=COUNT(1)FROM dbo.SplitToTable('1|2|3|4', '|') a INNER JOIN dbo.SplitToTable('1|2|3|', '|') b ON a.valu... 阅读全文
posted @ 2011-11-11 11:46 张占岭 阅读(3568) 评论(0) 推荐(0)
摘要: 前几天看了老赵的Translate方式解决多表关联后产生实体类型问题,但多数据量时还是不太妥当,所以最后还是用老的方法,建立一个实体类来解决这个问题 首先我让实体类和LINQ表类型名称一样,只是加了个后缀用来区分,并让它去继承LINQ表对象,这样它将有表对象的所有非私有的属性和方法。 如图: IEntity是个接口,只要继承它,就必须实现它的一个PrimaryKey这个属性,它用来统一表对象的主... 阅读全文
posted @ 2011-11-11 11:43 张占岭 阅读(1211) 评论(0) 推荐(0)
摘要: namespace Service{ public class Service<TEntity> : IService<TEntity> where TEntity : class,Entity.IEntity { private IRepository<TEntity> iRepository = null; public Service() { iRepository = new Repository<TEntity>(); } #region IService<TEntity> 成员 public TEntity GetMode 阅读全文
posted @ 2011-11-08 13:40 张占岭 阅读(2124) 评论(0) 推荐(1)
摘要: namespace Data.TEST{ /// /// 数据通用操作实现 /// /// public class Repository : TESTRepositoryBase, IRepository where TEntity : class,IEntit... 阅读全文
posted @ 2011-11-08 13:36 张占岭 阅读(5980) 评论(2) 推荐(2)
上一页 1 ··· 342 343 344 345 346 347 348 349 350 ··· 380 下一页