示例#1
0
 private IEnumerable <DataModel> StreamProcessPhase3(IEnumerable <DataModel> models)
 {
     foreach (var model in models)
     {
         DataModelHelper.ProcessPhase3(model);
         yield return(model);
     }
 }
示例#2
0
 public static IEnumerable <DataModel> StreamProcessPhase2(IEnumerable <DataModel> models)
 {
     foreach (var model in models)
     {
         DataModelHelper.ProcessPhase2(model);
         yield return(model);
     }
 }
示例#3
0
 public void Test1()
 {
     foreach (var model in GetModels())
     {
         DataModelHelper.ProcessPhase1(model);
         DataModelHelper.ProcessPhase2(model);
         DataModelHelper.ProcessPhase3(model);
     }
 }
示例#4
0
 /// <summary>
 /// 串流處理:處理完一個物件的phase1,2,3才抓下一個物件
 /// WIP只會有一個
 /// </summary>
 private static void Demo2()
 {
     foreach (var model in GetModels())
     {
         DataModelHelper.ProcessPhase1(model);
         DataModelHelper.ProcessPhase2(model);
         DataModelHelper.ProcessPhase3(model);
     }
 }
        /// <summary>
        /// 获取数据库值转换接口
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public static IDbValueConvertor GetDbValueConvertor(this IDataFieldModel field)
        {
            Type v = DataModelHelper.GetExtendProerty_DbFieldValueConvertType(field.InnerExtend);

            if (v != null)
            {
                return(v.CreateObject() as IDbValueConvertor);
            }
            return(null);
        }
示例#6
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            UserDomain user = null;

            if (LicenseSoftwareSettings.UseLdap)
            {
                user = UserDomain.Current;
            }
            if (user == null)
            {
                toolStripLabelHelloUser.Text = "";
            }
            else
            {
                toolStripLabelHelloUser.Text = @"Здравствуйте, " + user.DisplayName;
            }
            //Загружаем права пользователя
            AccessControl.LoadPriveleges();
            if (AccessControl.HasNoPriveleges())
            {
                MessageBox.Show(@"У вас нет прав на использование данного приложения", @"Ошибка",
                                MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                Application.Exit();
                return;
            }
            //Инициируем начальные параметры CallbackUpdater
            DataModelsCallbackUpdater.GetInstance().Initialize();
            //Загружаем данные в асинхронном режиме
            PreLoadData();
            //Обновляем состояние главного меню
            MainMenuStateUpdate();
            if (string.IsNullOrEmpty(_computerNameCommandLineArg))
            {
                return;
            }
            var device = DataModelHelper.FilterRows(DevicesDataModel.GetInstance().Select())
                         .FirstOrDefault(r => r.Field <string>("Device Name").Contains(_computerNameCommandLineArg));

            if (device == null)
            {
                return;
            }
            var viewport = ViewportFactory.CreateViewport(this, ViewportType.InstallationsViewport);

            viewport.DynamicFilter = string.Format("[ID Computer] = {0}", device.Field <int>("ID Device"));

            if (((IMenuController)viewport).CanLoadData())
            {
                ((IMenuController)viewport).LoadData();
            }
            AddViewport(viewport);
            ChangeMainMenuState();
            StatusBarStateUpdate();
            ChangeViewportsSelectProprty();
        }
示例#7
0
        private void SetDataContext()
        {
            var question = DataModelHelper.GetNextQuestion();

            if (DataModelHelper.HasMultipleChoices)
            {
                DataContext = new MultipleChoicesViewModel(question);
            }
            else
            {
                DataContext = new SingleChoiceViewModel(question);
            }
        }
示例#8
0
        public T GetDataObject <T>(SqlCommand command)
        {
            using (SqlConnection connection = new SqlConnection(Connection_String))
            {
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }

                command.Connection     = connection;
                command.CommandTimeout = Connection_Timeout;
                return(DataModelHelper.CreateObject <T>(command.ExecuteReader()));
            }
        }
示例#9
0
        // GET: Data
        public ActionResult Index()
        {
            DataModel model = new DataModel();

            SubjectManager manager = new SubjectManager();

            //model.Species = DataModelHelper.ToDataTable<Species>(manager.GetAll<Species>());

            List <PlantModel> lPLants = new List <PlantModel>();

            manager.GetAll <Plant>().ToList().ForEach(p => lPLants.Add(PlantModel.Convert(p)));
            model.Plants = DataModelHelper.ToDataTable <PlantModel>(lPLants);
            return(View(model));
        }
示例#10
0
        protected override void Calculate(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            DmLoadState = DataModelLoadState.Loading;
            if (e == null)
            {
                throw new DataModelException("Не передана ссылка на объект DoWorkEventArgs в классе CalcDataModelLicensesConcat");
            }
            var config = (CalcAsyncConfig)e.Argument;
            // Фильтруем удаленные строки
            var licenses = DataModelHelper.FilterRows(SoftLicensesDataModel.GetInstance().Select(), config.Entity, config.IdObject);
            var licKeys  = DataModelHelper.FilterRows(SoftLicKeysDataModel.GetInstance().Select(), config.Entity, config.IdObject);
            // Вычисляем агрегационную информацию
            var result = from licensesRow in licenses
                         join licKeyRow in licKeys
                         on licensesRow.Field <int>("ID License") equals licKeyRow.Field <int>("ID License")
                         select new
            {
                id_lickey  = licKeyRow.Field <int>("ID LicenseKey"),
                id_license = licensesRow.Field <int>("ID License"),
                lickey     =
                    string.Format("{0} (в/н лицензии: {1}; срок действия: №{2} от {3})",
                                  licKeyRow.Field <string>("LicKey"),
                                  licensesRow.Field <int>("ID License"),
                                  licensesRow.Field <string>("DocNumber") ?? "б/н",
                                  licensesRow.Field <DateTime>("BuyLicenseDate").ToString("dd.MM.yyyy", CultureInfo.InvariantCulture) +
                                  (licensesRow.Field <DateTime?>("ExpireLicenseDate") == null ? " (бессрочно)" :
                                   " по " + licensesRow.Field <DateTime>("ExpireLicenseDate").ToString("dd.MM.yyyy", CultureInfo.InvariantCulture))
                                  )
            };
            // Заполняем таблицу изменений
            var table = InitializeTable();

            table.BeginLoadData();
            result.ToList().ForEach(x =>
            {
                table.Rows.Add(x.id_lickey, x.id_license, x.lickey);
            });
            table.EndLoadData();
            if (!DataSetManager.DataSet.Tables.Contains(TableName))
            {
                DataSetManager.AddTable(table);
            }
            else
            {
                DataSetManager.DataSet.Merge(table);
            }
            // Возвращаем результат
            e.Result = table;
        }
        /// <summary>
        /// 获取数据data的字段值
        /// <para>如果数据data实现接口IDataRowReader,则返回Item[name]</para>
        /// </summary>
        /// <param name="field"></param>
        /// <param name="data">要获取字段值的数据</param>
        /// <returns></returns>
        public static object GetModelFieldValue(this IDataFieldModel field, object data)
        {
            if (data is IDataRowReader)
            {
                IDataRowReader r = data as IDataRowReader;
                return(r[field.Name]);
            }
            PropertyDescriptor pd = DataModelHelper.GetExtendProerty_PropertyDescription(field.InnerExtend);

            if (pd != null)
            {
                return(pd.GetValue(data));
            }
            throw new ObjectIsNullException(LocalResource.FieldPropertyDescriptor);
        }
示例#12
0
        public static IEnumerable <DataModel> BlockedCollectionProcessPhase3(IEnumerable <DataModel> models)
        {
            BlockingCollection <DataModel> result = new BlockingCollection <DataModel>(BLOCKING_COLLECTION_CAPACITY);

            Task.Run(() =>
            {
                foreach (var model in models)
                {
                    DataModelHelper.ProcessPhase3(model);
                    result.Add(model);
                }
                result.CompleteAdding();
            });
            return(result.GetConsumingEnumerable());
        }
示例#13
0
        private static void Main(string[] args)
        {
            var json       = JsonSerializer.Create();
            var jsonreader = new JsonTextReader(Console.In);

            jsonreader.SupportMultipleContent = true;

            while (jsonreader.Read())
            {
                var d = json.Deserialize <DataModel>(jsonreader);

                DataModelHelper.ProcessPhase3(d);

                json.Serialize(Console.Out, d);
            }
        }
示例#14
0
        private IEnumerable <DataModel> StreamAsyncProcessPhase2(IEnumerable <DataModel> models)
        {
            Task <DataModel> previous_result = null;

            foreach (var model in models)
            {
                if (previous_result != null)
                {
                    yield return(previous_result.Result);
                }
                previous_result = Task.Run <DataModel>(() => { DataModelHelper.ProcessPhase2(model); return(model); });
            }
            if (previous_result != null)
            {
                yield return(previous_result.GetAwaiter().GetResult());
            }
        }
示例#15
0
        /// <summary>
        /// 批次處理:依序執行所有物件的phase1,再做所有的phase2,最後做所有的phase3
        /// WIP與任務數量呈正比
        /// </summary>
        private static void Demo1()
        {
            DataModel[] models = GetModels().ToArray();

            foreach (var model in models)
            {
                DataModelHelper.ProcessPhase1(model);
            }

            foreach (var model in models)
            {
                DataModelHelper.ProcessPhase2(model);
            }

            foreach (var model in models)
            {
                DataModelHelper.ProcessPhase3(model);
            }
        }
        /// <summary>
        /// 设置数据data的字段值为fieldvalue
        /// <para>如果data实现接口IDataRowSetter,则调用IDataRowSetter.SetFieldValue</para>
        /// </summary>
        /// <param name="field"></param>
        /// <param name="data">要设置值的数据</param>
        /// <param name="fieldvalue">要设置为的字段值</param>
        public static void SetModelFieldValue(this IDataFieldModel field, object data, object fieldvalue)
        {
            if (data is IDataRowSetter)
            {
                IDataRowSetter s = data as IDataRowSetter;
                s.SetFieldValue(field.Name, fieldvalue);
                return;
            }
            PropertyDescriptor pd = DataModelHelper.GetExtendProerty_PropertyDescription(field.InnerExtend);

            if (pd != null)
            {
                pd.SetValue(data, fieldvalue);
            }
            else
            {
                throw new ObjectIsNullException(LocalResource.FieldPropertyDescriptor);
            }
        }
示例#17
0
        public List <T> GetDataList <T>(SqlCommand command)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(Connection_String))
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    command.Connection     = connection;
                    command.CommandTimeout = Connection_Timeout;
                    return(DataModelHelper.CreateList <T>(command.ExecuteReader()));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#18
0
        public static IEnumerable <DataModel> StreamAsyncProcessPhase1(IEnumerable <DataModel> models)
        {
            Task <DataModel> previous_result = null;

            foreach (var model in models)
            {
                // 再送下一筆之前,先判斷上一筆是否完成作業
                // 跟這個迴圈要資料的phase2,就可以等上一筆做完之後,直接return給phase2
                // (因為是管線的關係,每一個phase只能有一個正在執行,所以要等上一筆做完)
                // 然後這個迴圈就可以在去抓下一筆資料來做
                if (previous_result != null)
                {
                    yield return(previous_result.GetAwaiter().GetResult());
                }
                previous_result = Task.Run <DataModel>(() => { DataModelHelper.ProcessPhase1(model); return(model); });
            }
            if (previous_result != null)
            {
                yield return(previous_result.GetAwaiter().GetResult());
            }
        }
 /// <summary>
 /// 指示该字段是否是行版本
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static bool IsRowVersion(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProerty_RowVersion(field.InnerExtend));
 }
 /// <summary>
 /// 获取字段的缺省值
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static string GetDefaultValue(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProperty_DefaultValue(field.InnerExtend));
 }
示例#21
0
 private void EasyView_Clicked(object sender, RoutedEventArgs e)
 {
     DataModelHelper.InitData(QuestionType.EasyQuestion);
     SetDataContext();
 }
 /// <summary>
 /// 获取字段对Id的引用信息
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static IDataIdRefence GetDataIdRefence(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProerty_DataIdRefence(field.InnerExtend));
 }
 /// <summary>
 /// 获取数据模型的软删除字段名称
 /// <para>如果该模型不是软删除模型,则返回null</para>
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static string GetSoftDeleteFieldName(this IDataModel model)
 {
     return(DataModelHelper.GetExtendProperty_SoftDeleteFieldName(model.InnerExtend));
 }
示例#24
0
        internal override string GetFilter()
        {
            var        filter = "";
            List <int> includedSoftwareIds = null;

            if (checkBoxLicTypeEnable.Checked && (comboBoxLicType.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "[ID LicType] = '{0}'", comboBoxLicType.SelectedValue);
            }
            if (checkBoxLicDocTypeEnable.Checked && (comboBoxLicDocType.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "[ID DocType] = '{0}'", comboBoxLicDocType.SelectedValue);
            }
            if (checkBoxSupplierEnable.Checked && (comboBoxSupplierID.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "[ID Supplier] = '{0}'", comboBoxSupplierID.SelectedValue);
            }
            if (checkBoxDepartmentEnable.Checked && (comboBoxDepartmentID.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                var selectedDepartments = DataModelHelper.GetDepartmentSubunits((int)comboBoxDepartmentID.SelectedValue).
                                          Union(new List <int> {
                    (int)comboBoxDepartmentID.SelectedValue
                });
                var accessibleDepartments = from departmentsRow in DataModelHelper.
                                            FilterRows(DepartmentsDataModel.GetInstance().SelectVisibleDepartments())
                                            where departmentsRow.Field <bool>("AllowSelect")
                                            select departmentsRow.Field <int>("ID Department");

                var departments = selectedDepartments.Intersect(accessibleDepartments).ToList();
                if (!departments.Any())
                {
                    throw new ViewportException("Вы не состоите ни в одном из департаментов.");
                }
                filter += "[ID Department] IN (";
                foreach (var id in departments)
                {
                    filter += id.ToString(CultureInfo.InvariantCulture) + ",";
                }
                filter = filter.TrimEnd(',') + ")";
            }
            else
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                var accessibleDepartments = (from departmentsRow in DataModelHelper.FilterRows(DepartmentsDataModel.GetInstance().SelectVisibleDepartments())
                                             where departmentsRow.Field <bool>("AllowSelect")
                                             select departmentsRow.Field <int>("ID Department")).ToList();
                if (!accessibleDepartments.Any())
                {
                    throw new ViewportException("Вы не состоите ни в одном из департаментов.");
                }
                filter += "[ID Department] IN (";
                foreach (var id in accessibleDepartments)
                {
                    filter += id.ToString(CultureInfo.InvariantCulture) + ",";
                }
                filter = filter.TrimEnd(',') + ")";
            }
            if (checkBoxDocNumberEnable.Checked)
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "DocNumber LIKE'%{0}%'", textBoxDocNumber.Text.Trim().Replace("'", ""));
            }
            if (checkBoxSoftwareNameEnable.Checked && (comboBoxSoftwareName.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "[ID Version] = '{0}'", comboBoxSoftwareName.SelectedValue);
            }
            if (checkBoxBuyLicenseDateEnable.Checked)
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "BuyLicenseDate {0} #{1}#",
                                        ConvertDisplayEqExprToSql(
                                            comboBoxOpBuyLicenseDate.SelectedItem.ToString()),
                                        dateTimePickerBuyLicenseDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            }
            if (checkBoxExpireLicenseDateEnable.Checked)
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "ExpireLicenseDate {0} #{1}#",
                                        ConvertDisplayEqExprToSql(
                                            comboBoxOpExpireLicenseDate.SelectedItem.ToString()),
                                        dateTimePickerExpireLicenseDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            }
            if (checkBoxSoftwareMakerEnable.Checked && (comboBoxSoftwareMaker.SelectedValue != null))
            {
                var ids = DataModelHelper.GetSoftwareIDsBySoftMaker((int)comboBoxSoftwareMaker.SelectedValue);
                includedSoftwareIds = DataModelHelper.Intersect(null, ids).ToList();
            }
            if (checkBoxSoftwareTypeEnable.Checked && (comboBoxSoftwareType.SelectedValue != null))
            {
                var ids = DataModelHelper.GetSoftwareIDsBySoftType((int)comboBoxSoftwareType.SelectedValue);
                includedSoftwareIds = DataModelHelper.Intersect(includedSoftwareIds, ids).ToList();
            }
            if (checkBoxLicKeyEnable.Checked && (comboBoxLicKey.SelectedValue != null))
            {
                if (!string.IsNullOrEmpty(filter.Trim()))
                {
                    filter += " AND ";
                }
                filter += string.Format(CultureInfo.InvariantCulture, "[ID License] = '{0}'", comboBoxLicKey.SelectedValue);
            }
            if (checkBoxOnlyAvailableInstallations.Checked)
            {
                var installationsCount =
                    from installRow in DataModelHelper.FilterRows(SoftInstallationsDataModel.GetInstance().Select())
                    group installRow by installRow.Field <int>("ID License")
                    into gs
                    select new
                {
                    idLicense         = gs.Key,
                    istallationsCount = gs.Count()
                };
                var notAvailableLicenses =
                    (from licensesRow in DataModelHelper.FilterRows(SoftLicensesDataModel.GetInstance().Select())
                     join installRow in installationsCount
                     on licensesRow.Field <int>("ID License") equals installRow.idLicense
                     where licensesRow.Field <int?>("InstallationsCount") != null &&
                     (licensesRow.Field <int>("InstallationsCount") - installRow.istallationsCount <= 0)
                     select licensesRow.Field <int>("ID License")).ToList();
                if (notAvailableLicenses.Any())
                {
                    if (!string.IsNullOrEmpty(filter.Trim()))
                    {
                        filter += " AND ";
                    }
                    filter += "[ID License] NOT IN (0";
                    foreach (var id in notAvailableLicenses)
                    {
                        filter += id.ToString(CultureInfo.InvariantCulture) + ",";
                    }
                    filter = filter.TrimEnd(',') + ")";
                }
            }
            if (includedSoftwareIds == null || !includedSoftwareIds.Any())
            {
                return(filter);
            }
            if (!string.IsNullOrEmpty(filter.Trim()))
            {
                filter += " AND ";
            }
            filter += "[ID Version] IN (0";
            foreach (var id in includedSoftwareIds)
            {
                filter += id.ToString(CultureInfo.InvariantCulture) + ",";
            }
            filter = filter.TrimEnd(',') + ")";
            return(filter);
        }
 /// <summary>
 /// 获取字段模型的Clr数据类型
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static Type GetClrType(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProerty_ClrType(field.InnerExtend));
 }
示例#26
0
        /// <summary>
        /// build EntitiesInfos
        /// </summary>
        private static void BuildEntitiesInfos(AutumnDataSettings settings, Assembly callingAssembly, string apiVersion)
        {
            var entities  = new Dictionary <Type, EntityInfo>();
            var resources = new Dictionary <Type, ResourceInfo>();

            foreach (var type in (settings.EntityAssembly ?? callingAssembly).GetTypes())
            {
                var resourceAttribute = type.GetCustomAttribute <ResourceAttribute>(false);
                var entityAttribute   = type.GetCustomAttribute <EntityAttribute>(false);
                if (entityAttribute == null && resourceAttribute == null)
                {
                    continue;
                }


                PropertyInfo keyPropertyInfo              = null;
                PropertyInfo createDatePropertyInfo       = null;
                PropertyInfo lastModifiedDatePropertyInfo = null;
                PropertyInfo createByPropertyInfo         = null;
                PropertyInfo lastModifiedByPropertyInfo   = null;
                foreach (var property in type.GetProperties())
                {
                    var keyAttribute = property.GetCustomAttribute <IdAttribute>();
                    if (keyAttribute != null)
                    {
                        keyPropertyInfo = property;
                    }

                    if (property.GetCustomAttribute <CreatedDateAttribute>(true) != null &&
                        IsAuditableDateProperty(property))
                    {
                        createDatePropertyInfo = property;
                    }

                    if (property.GetCustomAttribute <LastModifiedDateAttribute>(true) != null &&
                        IsAuditableDateProperty(property))
                    {
                        lastModifiedDatePropertyInfo = property;
                    }

                    if (property.GetCustomAttribute <CreatedByAttribute>(true) != null &&
                        IsAuditableByProperty(property))
                    {
                        createByPropertyInfo = property;
                    }

                    if (property.GetCustomAttribute <LastModifiedByAttribute>(true) != null &&
                        IsAuditableByProperty(property))
                    {
                        lastModifiedByPropertyInfo = property;
                    }
                }

                entities.Add(type,
                             new EntityInfo(
                                 settings,
                                 type,
                                 entityAttribute,
                                 keyPropertyInfo,
                                 createDatePropertyInfo,
                                 lastModifiedDatePropertyInfo,
                                 createByPropertyInfo,
                                 lastModifiedByPropertyInfo));

                if (resourceAttribute != null)
                {
                    var proxyTypes = DataModelHelper.BuildModelsRequestTypes(type);
                    resources.Add(type, new ResourceInfo(
                                      settings,
                                      entities[type], resourceAttribute.Version ?? apiVersion, proxyTypes, resourceAttribute));
                }
            }

            Mapper.Reset();

            Mapper.Initialize(c =>
            {
                foreach (var value in resources.Values)
                {
                    foreach (var proxyType in value.ProxyRequestTypes)
                    {
                        c.CreateMap(proxyType.Value, value.EntityInfo.EntityType);
                    }
                }
            });

            settings.EntitiesInfos = new ReadOnlyDictionary <Type, EntityInfo>(entities);
            settings.ResourceInfos = new ReadOnlyDictionary <Type, ResourceInfo>(resources);
            settings.ApiVersions   = new ReadOnlyCollection <string>(settings.ResourceInfos.Values
                                                                     .Select(e => e.ApiVersion)
                                                                     .Distinct().OrderBy(e => e).ToList());
        }
 /// <summary>
 /// 获取字段模型的值是否可为NULL
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static bool CanbeNull(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProperty_CanbeNull(field.InnerExtend));
 }
 /// <summary>
 /// 指示该字段是否是软删除字段
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static bool IsSoftDeleteField(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProerty_IsSoftDeleteField(field.InnerExtend));
 }
 /// <summary>
 /// 获取字段的数据大小:返回0标识没有设置
 /// </summary>
 /// <param name="field"></param>
 /// <returns></returns>
 public static int GetFieldSize(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProperty_MaxLength(field.InnerExtend));
 }
 /// <summary>
 /// 判断字段模型是否是索引
 /// </summary>
 /// <param name="field"></param>
 /// <returns>如果该字段模型是索引则返回索引信息,否则返回null</returns>
 public static IDataModelFieldIndex IsIndexKey(this IDataFieldModel field)
 {
     return(DataModelHelper.GetExtendProperty_IndexKey(field.InnerExtend));
 }