コード例 #1
0
        public static void CreateTestData(IPosDbContext context, ApplicationIdentityUser user)
        {
            //old db
            var connetionString = ConfigurationManager.ConnectionStrings["OldIPosDbContext"];

            var categories = ImportExistingData <Category>(connetionString.ConnectionString).Result;

            categories.ToList().ForEach((e) =>
            {
                e.CreatedBy_Id = user.Id;
            });
            context.Set <Category>().AddOrUpdate(p => p.CategoryUId, categories.ToArray());
            context.SaveChanges();

            var adminUser = IposMembershipService.GetUserId("*****@*****.**");
            var products  = ImportExistingData <Product>(connetionString.ConnectionString).Result;

            products.ToList().ForEach((e) =>
            {
                e.CreatedBy_Id = user.Id;
                e.Category_UId = Rand.Next(1, categories.Count());
                e.Insert_UId   = adminUser;
            });
            context.Set <Product>().AddOrUpdate(p => p.ProductUId, products.ToArray());
            context.SaveChanges();
        }
コード例 #2
0
        public static void ConfigureIposMemberShip(IPosDbContext context)
        {
            var appMembershipSettings = new List <aspnet_SchemaVersions>
            {
                new aspnet_SchemaVersions {
                    Feature = "membership", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                },
                new aspnet_SchemaVersions {
                    Feature = "health monitoring", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                },
                new aspnet_SchemaVersions {
                    Feature = "personalization", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                },
                new aspnet_SchemaVersions {
                    Feature = "common", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                },
                new aspnet_SchemaVersions {
                    Feature = "profile", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                },
                new aspnet_SchemaVersions {
                    Feature = "role manager", CompatibleSchemaVersion = "1", IsCurrentVersion = true
                }
            };

            context.Set <aspnet_SchemaVersions>().AddOrUpdate(p => p.Feature, appMembershipSettings.ToArray());
            context.SaveChanges();
        }