当前位置: 首页>>代码示例>>C#>>正文


C# UnitOfWork.UpdateSchema方法代码示例

本文整理汇总了C#中UnitOfWork.UpdateSchema方法的典型用法代码示例。如果您正苦于以下问题:C# UnitOfWork.UpdateSchema方法的具体用法?C# UnitOfWork.UpdateSchema怎么用?C# UnitOfWork.UpdateSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnitOfWork的用法示例。


在下文中一共展示了UnitOfWork.UpdateSchema方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDataLayer

        static IDataLayer CreateDataLayer()
        {
            DevExpress.Xpo.Metadata.XPDictionary dict = new DevExpress.Xpo.Metadata.ReflectionDictionary();
            dict.GetDataStoreSchema(typeof(Person).Assembly);
            DataSetDataStore dataStore = new DataSetDataStore(new DataSet(), AutoCreateOption.DatabaseAndSchema);
            using(UnitOfWork uow = new UnitOfWork(new SimpleDataLayer(dict, dataStore))) {
                uow.UpdateSchema(typeof(Person));
                Person p1 = new Person(uow);
                p1.FirstName = "Slava";
                p1.LastName = "Donchak";

                Person p2 = new Person(uow);
                p2.FirstName = "Dan";
                p2.LastName = "Ignatov";

                Product xaf = new Product(uow);
                xaf.Name = "Xaf";
                xaf.Manager = p2;

                Product xpo = new Product(uow);
                xpo.Name = "Xpo";
                xpo.Manager = p1;

                uow.CommitChanges();
            }

            return new ThreadSafeDataLayer(dict, dataStore);
        }
开发者ID:IgnatovDan,项目名称:XPO-Deployment,代码行数:28,代码来源:MyXpoInMemoryDataService.svc.cs

示例2: MergeTypes

 public void MergeTypes(UnitOfWork unitOfWork, List<Type> persistentTypes, IDbCommand command)
 {
     var collection = new XPCollection(unitOfWork, WCTypesInfo.Instance.FindBussinessObjectType<IPersistentClassInfo>()).Cast<IPersistentClassInfo>().Where(info => info.MergedObjectFullName != null).ToList();
     foreach (IPersistentClassInfo classInfo in collection){
         XPClassInfo xpClassInfo = getClassInfo(classInfo.Session,classInfo.PersistentAssemblyInfo.Name+"."+ classInfo.Name,persistentTypes);
         var mergedXPClassInfo = getClassInfo(classInfo.Session, classInfo.MergedObjectFullName, persistentTypes) ?? classInfo.Session.GetClassInfo(ReflectionHelper.GetType(classInfo.MergedObjectFullName));
         if (xpClassInfo != null) {
             unitOfWork.UpdateSchema(xpClassInfo.ClassType, mergedXPClassInfo.ClassType);
             updateObjectType(unitOfWork, xpClassInfo, mergedXPClassInfo,command);
         }
     }
 }
开发者ID:gvilas,项目名称:eXpand,代码行数:12,代码来源:XpoObjectMerger.cs

示例3: Setup

        public override void Setup(ApplicationModulesManager moduleManager)
        {
            base.Setup(moduleManager);
            if (Application == null)
                return;
            TypesInfo.Instance.AddTypes(GetAdditionalClasses());

            var unitOfWork = new UnitOfWork { ConnectionString = _connectionString };
            unitOfWork.UpdateSchema();
            AddDynamicModules(moduleManager, unitOfWork, TypesInfo.Instance.PersistentAssemblyInfoType);
            Application.SetupComplete += (sender, args) => mergeTypes(unitOfWork);
            var existentTypesMemberCreator = new ExistentTypesMemberCreator();
            existentTypesMemberCreator.CreateMembers(unitOfWork, TypesInfo.Instance);
        }
开发者ID:corzar,项目名称:eXpand,代码行数:14,代码来源:WorldCreatorModuleBase.cs

示例4: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Creating database/deleting records...");
            using(UnitOfWork uow = new UnitOfWork()) {
                uow.ConnectionString = Constants.DatabaseConnectionString;
                uow.UpdateSchema(typeof(Person));
                foreach(Person p in new System.Collections.ArrayList(new XPCollection<Person>(uow))) {
                    uow.Delete(p);
                }
                foreach(Product p in new System.Collections.ArrayList(new XPCollection<Product>(uow))) {
                    uow.Delete(p);
                }
                uow.CommitChanges();
            }

            Console.WriteLine("Creating records...");
            using(UnitOfWork uow = new UnitOfWork()) {
                uow.ConnectionString = Constants.DatabaseConnectionString;
                uow.UpdateSchema(typeof(Person));
                Person p1 = new Person(uow);
                p1.FirstName = "Slava";
                p1.LastName = "Donchak";

                Person p2 = new Person(uow);
                p2.FirstName = "Dan";
                p2.LastName = "Ignatov";

                Product xaf = new Product(uow);
                xaf.Name = "Xaf";
                xaf.Manager = p2;

                Product xpo = new Product(uow);
                xpo.Name = "Xpo";
                xpo.Manager = p1;

                uow.CommitChanges();
            }
            Console.WriteLine("Database is recreated.");
            Console.ReadLine();
        }
开发者ID:IgnatovDan,项目名称:XPO-Deployment,代码行数:40,代码来源:Program_CreateDatabase.cs


注:本文中的UnitOfWork.UpdateSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。