Пример #1
0
        static void CreateMetaField2009_06_03()
        {
            using (DataContext.Current = new DataContext("Data source=S2;Initial catalog=ibn48portal;Integrated Security=SSPI;"))
            {
                MetaClass workflowClass = DataContext.Current.GetMetaClass(WorkflowDefinitionEntity.ClassName);

                using (MetaClassManagerEditScope scope = DataContext.Current.MetaModel.BeginEdit())
                {
                    workflowClass.DeleteMetaField("PlanDuration");

                    using (MetaFieldBuilder mfb = new MetaFieldBuilder(workflowClass))
                    {
                        //PlanFinishDate: DateTime
                        mfb.CreateDateTime("PlanFinishDate", "Plan Finish Date", true, true);

                        //PlanDuration: Duration
                        mfb.CreateDuration("PlanDuration", "Plan Duration", true, 60);

                        //PlanFinishTimeType: Enum (None, DateTime, Duration)
                        mfb.CreateEnumField("PlanFinishTimeType", "Plan Finish Time Type", "TimeType", false, "1", false);

                        mfb.SaveChanges();
                    }

                    scope.SaveChanges();
                }
            }
        }