protected virtual string GetInsertParameterNameList <TTableObject>(WhereClauseBuilder <TTableObject> whereClauseBuilder) where TTableObject : class, new() => string.Format(", ", typeof(TTableObject) .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.SetProperty) .Where(p => !p.IsDefined(typeof(KeyAttribute)) || !p.GetCustomAttribute <KeyAttribute>().AutoGenerated) .Select(p => $"{whereClauseBuilder.ParameterChar}{p.Name.ToLower()}") );
protected virtual string GetUpdateCriteriaParameterNameList <TTableObject>(WhereClauseBuilder <TTableObject> whereClauseBuilder, UpdateCriteria <TTableObject> updateCriteria) where TTableObject : class, new() => string.Join(", ", updateCriteria.Select(uc => $"{uc.Key}={whereClauseBuilder.ParameterChar}u_{uc.Key}"));
protected virtual IEnumerable <DbParameter> GetInsertDbParameterList <TTableObject>(TTableObject obj, WhereClauseBuilder <TTableObject> whereClauseBuilder) where TTableObject : class, new() { var parameters = new List <DbParameter>(); typeof(TTableObject) .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.SetProperty) .Where(p => !p.IsDefined(typeof(KeyAttribute)) || !p.GetCustomAttribute <KeyAttribute>().AutoGenerated) .ToList() .ForEach(p => { var parameter = this.CreateParameter(); parameter.ParameterName = $"{whereClauseBuilder.ParameterChar}{p.Name.ToLower()}"; parameter.Value = p.GetValue(obj); parameters.Add(parameter); }); return(parameters); }