public void DeleteBy(Action <TEntity> where) { TEntity local = (TEntity)Activator.CreateInstance(DynamicProxy.CreateDynamicProxyType <TEntity>()); where (local); Dictionary <string, object> modifiedProperties = DynamicProxy.GetModifiedProperties(local); this.DeleteBy(modifiedProperties); }
public TEntity GetSingle(Action <TEntity> condition) { TEntity local = (TEntity)Activator.CreateInstance(DynamicProxy.CreateDynamicProxyType <TEntity>()); condition(local); List <IDbDataParameter> dbParameters = new List <IDbDataParameter>(); string strWhere = this.ParseConditionFromProxyEntity(local, dbParameters); return(GetList(string.Join(",", this._propertyNames), strWhere, null, dbParameters.ToArray()).FirstOrDefault()); }
public IList <TEntity> GetList(Action <TEntity> where) { TEntity local = (TEntity)Activator.CreateInstance(DynamicProxy.CreateDynamicProxyType <TEntity>()); where (local); List <IDbDataParameter> dbParameters = new List <IDbDataParameter>(); string strWhere = this.ParseConditionFromProxyEntity(local, dbParameters); return(this.GetList(string.Join(",", this._propertyNames), strWhere, null, dbParameters.ToArray())); }
//public bool Exists(string where) //{ // string sql = "select count(1) from [" + this.TableName + "] where " + where; // return this.Exists(sql); //} public bool Exists(Action <TEntity> where) { TEntity local = (TEntity)Activator.CreateInstance(DynamicProxy.CreateDynamicProxyType <TEntity>()); where (local); List <IDbDataParameter> dbParameters = new List <IDbDataParameter>(); string condition = this.ParseConditionFromProxyEntity(local, dbParameters); string sql = "select " + string.Join(",", _properties.Select(x => x.Name)) + " from " + TableName; if (!string.IsNullOrWhiteSpace(condition)) { sql += " where " + condition; } return(this.Exists(sql, dbParameters.ToArray())); }
public TEntity CreateProxy() { return((TEntity)Activator.CreateInstance(DynamicProxy.CreateDynamicProxyType <TEntity>())); }