public static void cleanup() { using (ChurchMemberProfileEntities context = new ChurchMemberProfileEntities()) { context.Database.ExecuteSqlCommand("TRUNCATE TABLE PropertyTemplateItem"); context.Database.ExecuteSqlCommand("ALTER TABLE PropertyTemplateItem DROP CONSTRAINT FK_PropertyTemplateItem_PropertyTemplate"); context.Database.ExecuteSqlCommand("TRUNCATE TABLE PropertyTemplate;"); context.Database.ExecuteSqlCommand("ALTER TABLE PropertyTemplateItem WITH CHECK ADD CONSTRAINT [FK_PropertyTemplateItem_PropertyTemplate] FOREIGN KEY([TemplateID]) REFERENCES [dbo].[PropertyTemplate] ([RecordID])"); } }
public static void TruncateTable(string tableName) { using (ChurchMemberProfileEntities context = new ChurchMemberProfileEntities()) { context.Database.ExecuteSqlCommand(string.Format("TRUNCATE TABLE {0}", tableName)); } }
public static void ExecuteSQL(string sql) { using (ChurchMemberProfileEntities context = new ChurchMemberProfileEntities()) { context.Database.ExecuteSqlCommand(sql); } }