示例#1
0
		public static void CreateDefaultSchema()
		{
			var db = new Data.SecurityEntities();
			var item = db.SchemaVersions.FirstOrDefault(x => x.Feature == "common");
			if (item == null)
			{
				item = new Data.SchemaVersion();
				item.Feature = "common";
				item.CompatibleSchemaVersion = "1";
				item.IsCurrentVersion = true;
				db.SchemaVersions.AddObject(item);
				db.SaveChanges();
			}
			item = db.SchemaVersions.FirstOrDefault(x => x.Feature == "membership");
			if (item == null)
			{
				item = new Data.SchemaVersion();
				item.Feature = "membership";
				item.CompatibleSchemaVersion = "1";
				item.IsCurrentVersion = true;
				db.SchemaVersions.AddObject(item);
				db.SaveChanges();
			}
			item = db.SchemaVersions.FirstOrDefault(x => x.Feature == "role manager");
			if (item == null)
			{
				item = new Data.SchemaVersion();
				item.Feature = "role manager";
				item.CompatibleSchemaVersion = "1";
				item.IsCurrentVersion = true;
				db.SchemaVersions.AddObject(item);
				db.SaveChanges();
			}
		}
 /// <summary>
 /// Deprecated Method for adding a new object to the SchemaVersions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSchemaVersions(SchemaVersion schemaVersion)
 {
     base.AddObject("SchemaVersions", schemaVersion);
 }
 /// <summary>
 /// Create a new SchemaVersion object.
 /// </summary>
 /// <param name="feature">Initial value of the Feature property.</param>
 /// <param name="compatibleSchemaVersion">Initial value of the CompatibleSchemaVersion property.</param>
 /// <param name="isCurrentVersion">Initial value of the IsCurrentVersion property.</param>
 public static SchemaVersion CreateSchemaVersion(global::System.String feature, global::System.String compatibleSchemaVersion, global::System.Boolean isCurrentVersion)
 {
     SchemaVersion schemaVersion = new SchemaVersion();
     schemaVersion.Feature = feature;
     schemaVersion.CompatibleSchemaVersion = compatibleSchemaVersion;
     schemaVersion.IsCurrentVersion = isCurrentVersion;
     return schemaVersion;
 }