public void Serialize(BaseAssembly _object) { Clear(); using (TPADatabaseContext context = new TPADatabaseContext()) { DatabaseAssembly assemblyModel = (DatabaseAssembly)_object; context.AssemblyModel.Add(assemblyModel); context.SaveChanges(); } }
private void Clear() { using (TPADatabaseContext context = new TPADatabaseContext()) { context.Database.ExecuteSqlCommand("DELETE FROM ParameterModel WHERE ID != -1"); context.Database.ExecuteSqlCommand("DELETE FROM PropertyModel WHERE ID != -1"); context.Database.ExecuteSqlCommand("DELETE FROM MethodModel WHERE ID != -1"); context.Database.ExecuteSqlCommand("DELETE FROM TypeModel"); context.Database.ExecuteSqlCommand("DELETE FROM NamespaceModel WHERE ID != -1"); context.Database.ExecuteSqlCommand("DELETE FROM AssemblyModel WHERE ID != -1"); context.SaveChanges(); } }