Example #1
0
 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());
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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();
        }
Example #5
0
 public static void SetDbSetInfo(this RowInfo rowInfo, DbSetInfo dbSetInfo)
 {
     rowInfo._dbSetInfo = dbSetInfo;
 }
Example #6
0
 public static void SetIsTrackChanges(this DbSetInfo dbSetInfo, bool value)
 {
     dbSetInfo._isTrackChanges = value;
 }
Example #7
0
 public static bool GetIsTrackChanges(this DbSetInfo dbSetInfo)
 {
     return(dbSetInfo._isTrackChanges);
 }
Example #8
0
 public static void SetFieldInfos(this DbSetInfo dbSetInfo, FieldsList value)
 {
     dbSetInfo._fieldInfos = value;
 }
Example #9
0
 public static FieldsList GetFieldInfos(this DbSetInfo dbSetInfo)
 {
     return(dbSetInfo._fieldInfos);
 }
Example #10
0
 public static Dictionary <string, Field> GetFieldByNames(this DbSetInfo dbSetInfo)
 {
     return(dbSetInfo._fieldsByNames);
 }
Example #11
0
 public static void SetEntityType(this DbSetInfo dbSetInfo, Type value)
 {
     dbSetInfo._EntityType = value;
 }
Example #12
0
 public static Type GetEntityType(this DbSetInfo dbSetInfo)
 {
     return(dbSetInfo._EntityType);
 }