public static FieldName[] GetNames(this DbSetInfo dbSetInfo) { return(dbSetInfo.GetInResultFields().Select(fi => new FieldName { n = fi.fieldName, p = fi.fieldType == FieldType.Object ? fi.GetNames() : null }).ToArray()); }
public static object[] GetPKValues(this RowInfo rowInfo, IDataHelper dataHelper) { DbSetInfo dbSetInfo = rowInfo.GetDbSetInfo(); System.Type entityType = dbSetInfo.GetEntityType(); Field[] finfos = dbSetInfo.GetPKFields(); object[] result = new object[finfos.Length]; for (int i = 0; i < finfos.Length; ++i) { ValueChange fv = rowInfo.values.Single(v => v.fieldName == finfos[i].fieldName); result[i] = dataHelper.DeserializeField(entityType, finfos[i], fv.val); } return(result); }
public static string GetWherePKPredicate(this RowInfo rowInfo) { DbSetInfo dbSetInfo = rowInfo.GetDbSetInfo(); Field[] pkFieldsInfo = dbSetInfo.GetPKFields(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < pkFieldsInfo.Length; ++i) { if (i > 0) { sb.Append(" and "); } sb.Append($"{pkFieldsInfo[i].fieldName}.Equals(@{i})"); } string predicate = sb.ToString(); return(predicate); }
public static void Initialize(this DbSetInfo dbSetInfo, IDataHelper dataHelper) { dbSetInfo._fieldsByNames = new Dictionary <string, Field>(); Field[] fieldInfos = dbSetInfo.fieldInfos.ToArray(); int cnt = fieldInfos.Length; for (int i = 0; i < cnt; ++i) { dataHelper.ForEachFieldInfo("", fieldInfos[i], (fullName, fieldInfo) => { fieldInfo.SetFullName(fullName); dbSetInfo._fieldsByNames.Add(fullName, fieldInfo); }); } SetOrdinal(fieldInfos); Field[] pkFields = dbSetInfo.GetPKFields(); if (pkFields.Length < 1) { throw new DomainServiceException(string.Format(ErrorStrings.ERR_DBSET_HAS_NO_PK, dbSetInfo.dbSetName)); } Dictionary <string, Field> fbn = dbSetInfo.GetFieldByNames(); }
public static void SetDbSetInfo(this RowInfo rowInfo, DbSetInfo dbSetInfo) { rowInfo._dbSetInfo = dbSetInfo; }
public static void SetIsTrackChanges(this DbSetInfo dbSetInfo, bool value) { dbSetInfo._isTrackChanges = value; }
public static bool GetIsTrackChanges(this DbSetInfo dbSetInfo) { return(dbSetInfo._isTrackChanges); }
public static void SetFieldInfos(this DbSetInfo dbSetInfo, FieldsList value) { dbSetInfo._fieldInfos = value; }
public static FieldsList GetFieldInfos(this DbSetInfo dbSetInfo) { return(dbSetInfo._fieldInfos); }
public static Dictionary <string, Field> GetFieldByNames(this DbSetInfo dbSetInfo) { return(dbSetInfo._fieldsByNames); }
public static void SetEntityType(this DbSetInfo dbSetInfo, Type value) { dbSetInfo._EntityType = value; }
public static Type GetEntityType(this DbSetInfo dbSetInfo) { return(dbSetInfo._EntityType); }