void ExchangeClientExchangeSectorUpdate() { LogManager.WriteLog("Inside Exchange Sector update", LogManager.enumLogLevel.Info); lock (sectorHoldingobject) { object punk; _exchangeClient.ExchangeReadSector(out punk); var udPinfo = (IUDPinfo)punk; var udpNo = udPinfo.UDPNo; int MessageID = 0; var memoryList = MessageStore.Where(message => message.installationNo == udpNo); foreach (var store in memoryList) { LogManager.WriteLog("Inside for each = " + store.installationNo.ToString(), LogManager.enumLogLevel.Info); if (Int32.Parse(store.GamePosition) != 0) { if (punk.GetType() == typeof(Sector205Data)) { var sector205Data = (Sector205Data)punk; var counter205 = sector205Data.Get205Data; var returnObjectLength = sector205Data.CommandLength; if (returnObjectLength == 2) { DBBuilder.UpdateAAMSStatus(store.badId, "1", "Game Enable/Disable Completed for Game - " + store.GamePosition + " Installation No - " + store.installationNo.ToString(), 4, store.installationNo, DateTime.Now); } MessageID = store.messageId; } } } MessageStore.RemoveAll(x => x.messageId == MessageID); } }
private void ProcessRequest(object sender, System.Timers.ElapsedEventArgs e) { System.Timers.Timer timer = sender as System.Timers.Timer; try { timer.Stop(); // Instant Periodic Interval Modified bool isModified = DBBuilder.IsInstantPeriodicIntervalModified(); // Modified ? if (isModified) { LogManager.WriteLog("|##> +YES+ Change in Instant Periodic Interval found.", LogManager.enumLogLevel.Info); this.SendSectorCommand(); } else { LogManager.WriteLog("|##> -NO- No change in Instant Periodic Interval found.", LogManager.enumLogLevel.Info); } } catch (Exception ex) { ExceptionManager.Publish(ex); } finally { if (!this.IsObjectInactive) { timer.Start(); } } }
/// <summary> /// 根据贴入对象和标签值查找标签贴入数据和匹配程度 /// </summary> /// <param name="targetID"></param> /// <param name="tagIDs"></param> /// <returns>查询语句</returns> internal string GetTargetObjectIDWithGroupByTargetIDAndTagIDs(long targetID, long[] tagIDs, out int tagClassCount) { if (tagIDs == null || tagIDs.Length == 0) { tagIDs = new long[] { 0 } } ; //对输入标签按"标签组"分组 StringBuilder sb = new StringBuilder(); var kvs = this.UnitOfWork.ToDataTable(DBBuilder.Define("select TagClassID,ID from SYSTag where id in(" + ALConvert.ToString(tagIDs) + ")")) .AsEnumerable() .GroupBy(d => d.Field <int>("TagClassID")); tagClassCount = kvs.Count(); foreach (var kv in kvs) { //获取当前"标签组"的标签 var ids = ALConvert.ToString(kv.Select(d => d.Field <int>("ID"))); sb.AppendFormat(@"max(case when TagID in ({0}) then 1 else 0 end)+", ids); } return(string.Format(SYSTagApplySql.GetTargetObjectIDWithGroupSql, targetID, sb.ToString(), this.systemID.HasValue ? ("and SystemID=" + this.systemID) : "")); }
/// <summary> /// 附件读取 /// </summary> /// <param name="id">附件id</param> /// <param name="action">文件流操作</param> /// <param name="unitOfWork">操作单元</param> public void ReadFile(long?id, Action <Stream> action, IUnitOfWork unitOfWork = null) { if (!id.HasValue) { id = this.ID; } if (!(id > 0) || action == null) { return; } var builder = DBBuilder.Define(@"SELECT FileContent.PathName(), GET_FILESTREAM_TRANSACTION_CONTEXT() FROM STDAttach Where ID=@ID", new { ID = id }); (unitOfWork ?? this.UnitOfWork).ToReader(builder, reader => { using (var sqlReader = (reader as IWrappedDataReader).Reader as SqlDataReader) { if (sqlReader.HasRows) { while (sqlReader.Read()) { using (var stream = new SqlFileStream(sqlReader.GetString(0), sqlReader.GetSqlBytes(1).Buffer, FileAccess.Read)) { action(stream); } } } } }); }
/// <summary> /// 保存文件 /// </summary> /// <param name="outputStream">需要保存的文件</param> /// <param name="id">附件id</param> /// <param name="unitOfWork">操作单元</param> public void WriteFile(Stream outputStream, long?id = null) { if (!id.HasValue) { id = this.ID; } if (!(id > 0) || outputStream == null) { return; } var builder = DBBuilder.Define(@"UPDATE STDAttach SET FileContent=CAST('' as varbinary(max)) WHERE ID=@ID; SELECT FileContent.PathName(), GET_FILESTREAM_TRANSACTION_CONTEXT() FROM STDAttach Where ID=@ID", new { ID = id }); this.UnitOfWork.ToReader(builder, reader => { using (var sqlReader = (reader as IWrappedDataReader).Reader as SqlDataReader) { while (sqlReader.Read()) { using (var stream = new SqlFileStream(sqlReader.GetString(0), sqlReader.GetSqlBytes(1).Buffer, FileAccess.Write)) { outputStream.CopyTo(stream); } } } }); }
public FieldSpec(string propertyName, IEnumerable <TProperty> propertyValues) { if (propertyValues == null || !propertyValues.Any()) { var spec = new FalseSpec <TEntity>(); Lambda = spec.Lambda; Sql = new FalseSpec <TEntity>().Sql; } else if (propertyValues.Count() == 1) { var prop = typeof(TEntity).GetProperty(propertyName); var entity = Expression.Parameter(typeof(TEntity), "entity"); var left = Expression.Constant(propertyValues.First()); var right = IsNullableType(prop.PropertyType) ? Expression.Property(Expression.Property(entity, prop), "Value") : Expression.Property(entity, prop); var exp = Expression.Equal(left, right); Lambda = Expression.Lambda <Func <TEntity, bool> >(exp, entity); //Sql = DBBuilder.Define().Field(DataEntityUtils.Entity(typeof(TEntity)).TableAttribute.TableName, propertyName).Eq().Value(propertyValues.First()); Sql = DBBuilder.Define().Field(null, propertyName).Eq().Value(propertyValues.First()); } else { var prop = typeof(TEntity).GetProperty(propertyName); var entity = Expression.Parameter(typeof(TEntity), "entity"); var left = Expression.Constant(propertyValues.ToList()); var right = IsNullableType(prop.PropertyType) ? Expression.Property(Expression.Property(entity, prop), "Value") : Expression.Property(entity, prop); var exp = Expression.Call(left, "Contains", null, right); Lambda = Expression.Lambda <Func <TEntity, bool> >(exp, entity); //Sql = DBBuilder.Define().Field(DataEntityUtils.Entity(typeof(TEntity)).TableAttribute.TableName, propertyName).In(d => d.Value(propertyValues)); Sql = DBBuilder.Define().Field(null, propertyName).In(d => d.Value(propertyValues)); } }
public virtual bool Modify(TEntity entity, ISpecification <TEntity> specification) { if (this.OnModify != null) { OnModify(ref entity, ref specification); } DBBuilder condition; if (specification.Lambda != null) { var ids = this.Entities.Where(specification.Lambda).Select(d => d.ID).ToList(); if (ids.Count > 0) { condition = DBBuilder.Define().Field(_entityDefinition.Value.TableAttribute.TableName, "ID").In(builder => builder.Value(ids.ToArray())); } else { condition = new FalseSpec <TEntity>().Sql; } } else { condition = specification.Sql; } var fieldAndValues = GetFieldAndValue(entity, true, false); var dbBuilder = condition.IsCommand ? condition : DBBuilder.Update(_entityDefinition.Value.TableAttribute.TableName, fieldAndValues).Where(condition); var result = this.UnitOfWork.Execute(dbBuilder); return(result > 0); }
public virtual PagedList <TEntity> GetPaged(ISpecification <TEntity> specification, int pageIndex = 1, int pageSize = 15, SortExpression <TEntity> sortExpression = null) { if (specification == null) { specification = new TrueSpec <TEntity>(); } if (sortExpression == null) { sortExpression = new DefaultSortExpression <TEntity>(); } if (this.OnGet != null) { OnGet(ref specification); } if (specification.Lambda != null) { var count = this.Entities.Count(specification.Lambda); var result = sortExpression.Lambda(this.Entities.Where(specification.Lambda)).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); return(new PagedList <TEntity>(pageIndex, pageSize, count, result)); } else { var condition = specification.Sql; var dbBuilder = condition.IsSelect ? condition : DBBuilder.Select(_entityDefinition.Value.TableAttribute.TableName).Where(condition); return(this.UnitOfWork.ToList <TEntity>(dbBuilder, pageIndex, pageSize, sortExpression.Sql())); } }
public static string GetSettingValue(string ExchangeConnection, string strSettingName) { string sResult = string.Empty; int SettingID = 0; try { if (strSettingName != null && strSettingName != string.Empty) { Dictionary <int, string> dtSetting = new Dictionary <int, string>(); dtSetting = DBBuilder.GetSetting(ExchangeConnection, DBBuilder.AddParameter <int>("@Setting_ID", System.Data.DbType.Int32, SettingID, 32), DBBuilder.AddParameter <string>("@Setting_Name", System.Data.DbType.String, strSettingName, 500), DBBuilder.AddParameter <string>("@Setting_Default", System.Data.DbType.String, string.Empty, 500), DBBuilder.AddOutputParameter <string>("@Setting_Value", System.Data.DbType.String, string.Empty, 500)); foreach (KeyValuePair <int, string> objValue in dtSetting) { sResult = objValue.Value.ToString(); } } } catch (Exception ex) { ExceptionManager.Publish(ex); } return(sResult); }
/// <summary> /// 根据标签代码获得标签项 /// </summary> /// <param name="TagClassCode"></param> /// <param name="tagName"></param> /// <returns></returns> internal DataTable GetTagByTagClassCode(string TagClassCode, string tagCode, string tagValue) { if (!string.IsNullOrEmpty(tagCode)) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagByTagClassCode_TagCode, new { ClassCode = TagClassCode, tagCode = tagCode, SystemID = systemID, }))); } else if (!string.IsNullOrEmpty(tagValue)) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagByTagClassCode_TagValue, new { ClassCode = TagClassCode, tagValue = tagValue, SystemID = systemID, }))); } else { return(null); } }
/// <summary> /// Get Ticketing Connection String /// </summary> /// <param name="ExchangeConnection"></param> /// <returns>Ticketing Connection String</returns> /// Method Revision History /// /// Author Date Description /// --------------------------------------------------- /// Anuradha 10-Dec-2008 Intial Version /// public static string TicketingConnectionString(string ExchangeConnection) { string strTicketingConnectionString = string.Empty; int SettingID = 0; try { Dictionary <int, string> dtSetting = new Dictionary <int, string>(); dtSetting = DBBuilder.GetSetting(ExchangeConnection, DBBuilder.AddParameter <int>("@Setting_ID", System.Data.DbType.Int32, SettingID, 32), DBBuilder.AddParameter <string>("@Setting_Name", System.Data.DbType.String, DBConstants.TICKETINGCONNECTIONSETTING, 500), DBBuilder.AddParameter <string>("@Setting_Default", System.Data.DbType.String, string.Empty, 500), DBBuilder.AddOutputParameter <string>("@Setting_Value", System.Data.DbType.String, string.Empty, 500)); foreach (KeyValuePair <int, string> objValue in dtSetting) { strTicketingConnectionString = objValue.Value.ToString(); } } catch (Exception ex) { LogManager.WriteLog("TicketingConnectionString" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error); ExceptionManager.Publish(ex); } return(strTicketingConnectionString); }
/// <summary> /// 删除指定标签的贴入数据 /// </summary> /// <param name="tagID"></param> /// <returns></returns> internal int DeleteByTagID(long tagID) { return(this.UnitOfWork.Execute(DBBuilder.Define(SYSTagApplySql.DeleteByTagIDSql, new { TagID = tagID, SystemID = systemID, }))); }
/// <summary> /// 更新指定标签项的排序 /// </summary> /// <param name="tagClassID"></param> private void UpdateChildTagByParant(long?tagClassID) { this.UnitOfWork.Execute(DBBuilder.Define(SYSTagSql.UpdateChildTagByParant, new { TagClassID = tagClassID, SystemID = systemID, })); }
public DataTable GetTagByTagClass(string TagClass) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagByTagClass, new { ClassName = TagClass, SystemID = systemID, }))); }
/// <summary> /// 根据标签代码获得标签项 /// </summary> /// <param name="TagClassCode"></param> /// <returns></returns> internal DataTable GetTagByTagClassCode(string TagClassCode) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagByTagClassCode, new { ClassCode = TagClassCode, SystemID = systemID, }))); }
public virtual string Sql() { if (SortList == null || SortList.Count == 0) { return(string.Empty); } return(string.Join(",", SortList.Select(item => string.Format("{0} {1}", DBBuilder.Define().Field(null, item.Key), item.Value ? "asc" : "desc")))); }
public Dictionary <string, string> FillRouteFilter() { //Routes Dictionary <string, string> dRoutes = DBBuilder.GetRoutes(); return(dRoutes); }
public long CreateUser(string name) { var entity = new { ID = CFID.NewID(), Name = "张三" }; dbQuery.Execute(DBBuilder.Insert("TCTest", entity)); Console.WriteLine("用户已创建,用户编号:" + entity.ID); return(entity.ID); }
// #region MachineConfig /// <summary> /// Called when [Machine config action]. /// </summary> /// <param name="threadData">The thread data.</param> private void OnMachineConfigAction(MachineConfigThreadData threadData) { if (!threadData.CheckAndWriteLog("OnMachineConfigAction", "Method Invoked successfully.")) { return; } #if DEBUG //System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); //watch.Start(); //if (!threadData.CheckAndWriteLog("OnMachineConfigAction", "Method Started at : " + DateTime.Now.ToString())) return; #endif try { if (threadData.Installation_Float_Status == 1 && DBBuilder.GetSettingFromDB("DISABLE_MACHINE_ON_DROP", "FALSE").ToUpper() == "TRUE") { LogManager.WriteLog("Disabling the Installation - " + threadData.Installation_No.ToString(), LogManager.enumLogLevel.Info); threadData.Enable = false; threadData.datapakCurrentState = 0; EnableDisableMachine(threadData); //ThreadPool.QueueUserWorkItem(new WaitCallback(EnableDisableMachine), _autoEnableDisable); string strComment = "Machine Floated and Setting DISABLE_MACHINE_ON_DROP {True} hence disabling."; LogManager.WriteLog(strComment, LogManager.enumLogLevel.Info); DBBuilder.UpdateCommentsForAAMS(threadData.badId.ToString(), strComment, 3, 0); } else { if (threadData.enterprisestatus) { threadData.Enable = true; threadData.datapakCurrentState = 1; EnableDisableMachine(threadData); LogManager.WriteLog("Enabling the Installation - " + threadData.Installation_No.ToString(), LogManager.enumLogLevel.Info); } else { threadData.Enable = false; threadData.datapakCurrentState = 0; EnableDisableMachine(threadData); string strComment = "Disabling the Installation - " + threadData.Installation_No.ToString(); LogManager.WriteLog(strComment, LogManager.enumLogLevel.Info); DBBuilder.UpdateCommentsForAAMS(threadData.Installation_No.ToString(), strComment, 2, 0); } } } finally { #if DEBUG //watch.Stop(); //threadData.CheckAndWriteLog("OnMachineConfigAction", "Method Ended at : " + DateTime.Now.ToString()); //threadData.CheckAndWriteLog("OnMachineConfigAction", "Time Taken to execute : " + watch.Elapsed.ToString()); #endif Interlocked.Increment(ref nMachineThreadComplete); } }
/// <summary> /// 取出Tag表中的一批数据 /// </summary> /// <param name="classCodePrefix">目录前缀</param> /// <returns></returns> internal DataTable GetTagClass(string classCodePrefix, long?displayLevel) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.TagByCodePrefix, new { ClassCode = classCodePrefix ?? string.Empty, DisplayLevel = displayLevel, SystemID = systemID, }))); }
/// <summary> /// 根据父节点查找【下一级】子节点 /// </summary> /// <param name="parentID"></param> /// <returns></returns> internal DataTable GetTagsByParentID(long parentID) { if (this.systemID == null) { return(this.UnitOfWork.ToDataTable(DBBuilder.Select("Tag").Where(new { ParentID = parentID }))); } return(this.UnitOfWork.ToDataTable(DBBuilder.Select("Tag").Where(new { ParentID = parentID }).And().Eq(new { SystemID = this.systemID }))); }
/// <summary> /// 根据父节点查找【下一级】子节点 /// </summary> /// <param name="TagClassCode"></param> /// <param name="ParentName"></param> /// <returns></returns> internal DataTable GetTagsByParentID(string TagClassCode, string ParentName) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagsByParentName, new { ClassCode = TagClassCode, ParentName = ParentName, SystemID = systemID, }))); }
/// <summary> /// 根据标签类型获得标签 /// </summary> /// <param name="TagClassID"></param> /// <param name="ParentTagID"></param> /// <returns></returns> public DataTable GetTagByTagClassID(long TagClassID, long?ParentTagID) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagSql.GetTagByTagClassID, new { TagClassID = TagClassID, ParentID = ParentTagID, SystemID = systemID, }))); }
/// <summary> /// 删除全部已贴入标签 /// </summary> /// <param name="targetID"></param> /// <param name="targetObjectID"></param> /// <returns></returns> internal int DeleteByCompanyID(long targetID, long targetObjectID) { return(this.UnitOfWork.Execute(DBBuilder.Define(SYSTagApplySql.DeleteByCompanyIDSql, new { TargetID = targetID, TargetObjectID = targetObjectID, SystemID = systemID, }))); }
/// <summary> /// 得到指定标签组,指定标签类型的标签 /// </summary> /// <param name="classCodePrefix">目录前缀</param> /// <param name="displayLevel">标签类型</param> /// <returns></returns> public DataTable GetTagClass(string classCodePrefix, int?displayLevel) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagClassSql.TagClassByCodePrefix, new { GroupCode = classCodePrefix, DisplayLevel = displayLevel, SystemID = systemID, }))); }
/// <summary> /// 得到指定用户可用权限 /// </summary> /// <param name="tagOperate"></param> /// <returns></returns> internal DataTable GetAuthorityByCurrentUser(EnumSYSTagOperate tagOperate, long userID) { return(this.UnitOfWork.ToDataTable(DBBuilder.Define(SYSTagAuthoritySql.GetAuthorityByCurrentUserSql, new { CurrentUserID = userID, AcceptOperate = tagOperate, SystemID = systemID, }))); }
public void GetDataforAFT() { LogManager.WriteLog("[GetDataforAFT]- Start", LogManager.enumLogLevel.Info); DataTable dtAFT; int Message_ID; try { dtAFT = DBBuilder.GetAFTPollingData(); LogManager.WriteLog("[GetDataforAFT]- ResultSetCount: " + dtAFT.Rows.Count.ToString(), LogManager.enumLogLevel.Info); if ((dtAFT == null) || (dtAFT.Rows.Count == 0)) { LogManager.WriteLog("No machine to be enabled/disabled for AFT", LogManager.enumLogLevel.Info); return; } if (AFTMessages == null) { AFTMessages = new List <AFTMessages>(); } foreach (DataRow row in dtAFT.Rows) { switch (Convert.ToInt32(row["AFT_ED_Type"])) { case 1: Message_ID = SendSector203Comexchange(Convert.ToInt32(row["Installation_No"]), 76); AFTMessages.Add(new AFTMessages() { Installation_No = Convert.ToInt32(row["Installation_No"]), MessageID = Message_ID }); break; case 0: Message_ID = SendSector203Comexchange(Convert.ToInt32(row["Installation_No"]), 77); AFTMessages.Add(new AFTMessages() { Installation_No = Convert.ToInt32(row["Installation_No"]), MessageID = Message_ID }); break; default: break; } Thread.Sleep(10); } LogManager.WriteLog("[GetDataforAFT]- Start", LogManager.enumLogLevel.Info); } catch (Exception Ex) { ExceptionManager.Publish(Ex); } }
protected override void OnStart(string[] args) { //System.Diagnostics.Debugger.Break(); LogManager.WriteLog(string.Format("Starting Service ({0:D}).", Process.GetCurrentProcess().Id), LogManager.enumLogLevel.Info); IsStopRequested = false; try { //Get the connection string. _strConnectionString = DBBuilder.GetConnectionString(); } catch (Exception ex) { ExceptionManager.Publish(ex); } // Initialize application settings (App.config, setting table, etc...) this.InitSettings(); //ENABLE DISABLE if (Convert.ToBoolean(ConfigManager.Read("MachineConfig")) == true) { _EnableDisable = new EnableDisable(); } //TITO if (Convert.ToBoolean(ConfigManager.Read("TITO")) == true) { _TITO = new TITO(); } //AFTEnableDisable if (Convert.ToBoolean(ConfigManager.Read("AFTEnableDisable")) == true) { _enableDisableAFT = new AFTEnableDisable(); } //Employee Master card broadcast if (Convert.ToBoolean(ConfigManager.Read("EmployeecardBroadcast")) == true) { _empMastercard = new EmployeeMasterCard(); } //Instant Periodic Interval if (Convert.ToBoolean(ConfigManager.Read("InstantPeriodic")) == true) { _instantPeriodicInterval = new InstantPeriodicIntervalHandler(); } //Request/Response Wait Configuration NetworkServiceSettings.RequestWaitTime = Convert.ToInt32(ConfigManager.Read("RequestWaitMilliSeconds")); NetworkServiceSettings.DBHitWaitTime = Convert.ToInt32(ConfigManager.Read("DBHitWaitMilliSeconds")); LogManager.WriteLog("Started Service Successfully.", LogManager.enumLogLevel.Info); }
/// <summary> /// 这里需要处理object的类型 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <returns></returns> public ISpecification <TEntity> Compile <TEntity>() where TEntity : class { string value = _config.FilterValue; Expression <Func <TEntity, bool> > lambda = item => true; DBBuilder sql = DBBuilder.Define("1=1"); var param = Expression.Parameter(typeof(TEntity), "item"); var prorerty = Expression.Property(param, _propertyName); var valueExpress = Convert(value, typeof(TEntity).GetProperty(_propertyName).PropertyType); switch (_operationType) { case EnumFilterOperation.Equal: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.Equal(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Eq().Value(value); break; case EnumFilterOperation.NotEqual: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.NotEqual(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Ne().Value(value); break; case EnumFilterOperation.GreaterThan: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.GreaterThan(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Gt().Value(value); break; case EnumFilterOperation.GreaterThanOrEqual: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.GreaterThanOrEqual(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Ge().Value(value); break; case EnumFilterOperation.LessThan: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.LessThan(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Lt().Value(value); break; case EnumFilterOperation.LessThanOrEqual: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.LessThanOrEqual(prorerty, valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Le().Value(value); break; case EnumFilterOperation.Like: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.Call(prorerty, typeof(string).GetMethod("Contains"), valueExpress), param); sql = DBBuilder.Define().Field(null, _propertyName).Like().Value(value); break; case EnumFilterOperation.NotLike: lambda = Expression.Lambda <Func <TEntity, bool> >(Expression.IsFalse(Expression.Call(prorerty, typeof(string).GetMethod("Contains"), valueExpress)), param); sql = DBBuilder.Define().Field(null, _propertyName).Not().Like().Value(value); break; default: throw new ArgumentOutOfRangeException(); } return(new Spec <TEntity>(lambda, sql)); }
public void SetUp() { string fileName = "hot.db3"; if (File.Exists(fileName)) { File.Delete(fileName); } SQLiteConnection.CreateFile(fileName); _dataClient = DBBuilder.GetDataClient(DataProviderNames.SqLite); }