public void CreateDb() { TraceEvent teDebug = CreateEvent(TraceEventType.Debug, "Debug"); TraceEvent teActivity = CreateEvent(TraceEventType.Activity, "Activity"); TraceEvent teInfo = CreateEvent(TraceEventType.Info, "Info"); TraceEvent teError = CreateEvent(TraceEventType.Error, "Error"); uow.TraceEvents.Insert(teDebug); uow.TraceEvents.Insert(teActivity); uow.TraceEvents.Insert(teInfo); uow.TraceEvents.Insert(teError); WorkflowStatus wsInProgress = CreateStatus(WorkflowStatusType.InProgress, "InProgress"); WorkflowStatus wsCompleted = CreateStatus(WorkflowStatusType.Completed, "Completed"); WorkflowStatus wsAborted = CreateStatus(WorkflowStatusType.Aborted, "Aborted"); WorkflowStatus wsTerminated = CreateStatus(WorkflowStatusType.Terminated, "Terminated"); uow.WorkflowStatuses.Insert(wsInProgress); uow.WorkflowStatuses.Insert(wsCompleted); uow.WorkflowStatuses.Insert(wsAborted); uow.WorkflowStatuses.Insert(wsTerminated); SketchStatus skSaved = CreateSketchStatus("Saved", "Sketch Saved"); SketchStatus skDeployedDev = CreateSketchStatus("DeployedDev", "Deployed to dev"); SketchStatus skDeployedProd = CreateSketchStatus("DeployedProd", "Deployed to prod"); SketchStatus skSentToSketch = CreateSketchStatus("SentToSketch", "Sent To Sketch"); SketchStatus skAborted = CreateSketchStatus("Aborted", "Abort workflow deployment"); uow.SketchStatuses.Insert(skSaved); uow.SketchStatuses.Insert(skDeployedDev); uow.SketchStatuses.Insert(skDeployedProd); uow.SketchStatuses.Insert(skSentToSketch); uow.SketchStatuses.Insert(skAborted); WorkflowCode wc1 = CreateWorkflowCode("SampleWf1", "this is a sample wf code for testing (1)"); uow.WorkflowCodes.Insert(wc1); WorkflowConfiguration wfc1 = CreateWorkflowConfiguration(wc1, "BasicHttpBinding_FlowTasks", "", ""); uow.WorkflowConfigurations.Insert(wfc1); WorkflowCode wc2 = CreateWorkflowCode("SampleWf2", "this is a sample wf code for testing (2)"); uow.WorkflowCodes.Insert(wc2); WorkflowConfiguration wfc2 = CreateWorkflowConfiguration(wc2, "BasicHttpBinding_IFlowTasksOperations2", "http://localhost/Flow.Tasks.Workflows/SampleWf2.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc2); WorkflowCode wc3 = CreateWorkflowCode("SampleWf3", "this is a sample wf code for testing (3)"); uow.WorkflowCodes.Insert(wc3); WorkflowConfiguration wfc3 = CreateWorkflowConfiguration(wc3, "BasicHttpBinding_IFlowTasksOperations3", "http://localhost/Flow.Tasks.Workflows/SampleWf3.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc3); WorkflowCode wc4 = CreateWorkflowCode("SampleWf4", "this is a sample wf code for testing (4)"); uow.WorkflowCodes.Insert(wc4); WorkflowConfiguration wfc4 = CreateWorkflowConfiguration(wc4, "BasicHttpBinding_IFlowTasksOperations4", "http://localhost/Flow.Tasks.Workflows/SampleWf4.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc4); WorkflowCode wc5 = CreateWorkflowCode("SampleWf5", "this is a sample wf code for testing (5)"); uow.WorkflowCodes.Insert(wc5); WorkflowConfiguration wfc5 = CreateWorkflowConfiguration(wc5, "BasicHttpBinding_IFlowTasksOperations5", "http://localhost/Flow.Tasks.Workflows/SampleWf5.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc5); WorkflowCode wc6 = CreateWorkflowCode("SampleWf6", "this is a sample wf code for testing (6)"); uow.WorkflowCodes.Insert(wc6); WorkflowConfiguration wfc6 = CreateWorkflowConfiguration(wc6, "BasicHttpBinding_IFlowTasksOperations6", "http://localhost/Flow.Tasks.Workflows/SampleWf6.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc6); WorkflowCode wc7 = CreateWorkflowCode("SampleWf7", "this is a sample wf code for testing (7)"); uow.WorkflowCodes.Insert(wc7); WorkflowConfiguration wfc7 = CreateWorkflowConfiguration(wc7, "BasicHttpBinding_IFlowTasksOperations7", "http://localhost/Flow.Tasks.Workflows/SampleWf7.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc7); WorkflowCode wc8 = CreateWorkflowCode("SampleWf8", "this is a sample wf code for testing (8)"); uow.WorkflowCodes.Insert(wc8); WorkflowConfiguration wfc8 = CreateWorkflowConfiguration(wc8, "BasicHttpBinding_IFlowTasksOperations8", "http://localhost/ServiceWorkflowsVB/SampleWf8.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc8); WorkflowCode wc9 = CreateWorkflowCode("SampleWf9", "this is a sample wf code for testing (9)"); uow.WorkflowCodes.Insert(wc9); WorkflowConfiguration wfc9 = CreateWorkflowConfiguration(wc9, "BasicHttpBinding_IFlowTasksOperations9", "http://localhost/ServiceWorkflowsVB/SampleWf9.xamlx", "BasicHttpBinding_FlowTasks"); uow.WorkflowConfigurations.Insert(wfc9); // Topic TopicStatus topicNew = CreateTopicStatus("New", "New topic message"); TopicStatus topicRead = CreateTopicStatus("Read", "Read topic message"); uow.TopicStatuses.Insert(topicNew); uow.TopicStatuses.Insert(topicRead); }
protected override void Seed(FlowTasksEntities context) { TraceEvent teDebug = CreateEvent(TraceEventType.Debug, "Debug"); TraceEvent teActivity = CreateEvent(TraceEventType.Activity, "Activity"); TraceEvent teInfo = CreateEvent(TraceEventType.Info, "Info"); TraceEvent teError = CreateEvent(TraceEventType.Error, "Error"); context.TraceEvents.AddOrUpdate( te => te.Type, teDebug, teActivity, teError, teInfo ); WorkflowStatus wsInProgress = CreateStatus(WorkflowStatusType.InProgress, "InProgress"); WorkflowStatus wsCompleted = CreateStatus(WorkflowStatusType.Completed, "Completed"); WorkflowStatus wsAborted = CreateStatus(WorkflowStatusType.Aborted, "Aborted"); WorkflowStatus wsTerminated = CreateStatus(WorkflowStatusType.Terminated, "Terminated"); context.WorkflowStatuses.AddOrUpdate( ws => ws.Status, wsCompleted, wsAborted, wsInProgress, wsTerminated ); SketchStatus skSaved = CreateSketchStatus("Saved", "Sketch Saved"); SketchStatus skDeployedDev = CreateSketchStatus("DeployedDev", "Deployed to dev"); SketchStatus skDeployedProd = CreateSketchStatus("DeployedProd", "Deployed to prod"); SketchStatus skSentToSketch = CreateSketchStatus("SentToSketch", "Sent To Sketch"); SketchStatus skAborted = CreateSketchStatus("Aborted", "Abort workflow deployment"); context.SketchStatuses.AddOrUpdate( sk => sk.Status, skAborted, skDeployedDev, skDeployedProd, skSaved, skSentToSketch ); WorkflowCode wc1 = CreateWorkflowCode("SampleWf1", "this is a sample wf code for testing (1)"); WorkflowCode wc2 = CreateWorkflowCode("SampleWf2", "this is a sample wf code for testing (2)"); WorkflowCode wc3 = CreateWorkflowCode("SampleWf3", "this is a sample wf code for testing (3)"); WorkflowCode wc4 = CreateWorkflowCode("SampleWf4", "this is a sample wf code for testing (4)"); WorkflowCode wc4a = CreateWorkflowCode("SampleWf4a", "this is a sample wf code for testing (4a)"); WorkflowCode wc5 = CreateWorkflowCode("SampleWf5", "this is a sample wf code for testing (5)"); WorkflowCode wc6 = CreateWorkflowCode("SampleWf6", "this is a sample wf code for testing (6)"); WorkflowCode wc7 = CreateWorkflowCode("SampleWf7", "this is a sample wf code for testing (7)"); WorkflowCode wc8 = CreateWorkflowCode("SampleWf8", "this is a sample wf code for testing (8)"); WorkflowCode wc9 = CreateWorkflowCode("SampleWf9", "this is a sample wf code for testing (9)"); WorkflowCode wcSketch = CreateWorkflowCode("SketchWf", "Sketch workflow code"); WorkflowCode wcHoliday = CreateWorkflowCode("HolidayWf", "Holiday workflow code"); context.WorkflowCodes.AddOrUpdate( wc => wc.Code, wc1, wc2, wc3, wc4, wc4a, wc5, wc6, wc7, wc8, wc9, wcSketch, wcHoliday); WorkflowConfiguration wfc1 = CreateWorkflowConfiguration(wc1, "", "", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc2 = CreateWorkflowConfiguration(wc2, "BasicHttpBinding_IFlowTasksOperations2", "http://localhost/Flow.Tasks.Workflows/SampleWf2.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc3 = CreateWorkflowConfiguration(wc3, "BasicHttpBinding_IFlowTasksOperations3", "http://localhost/Flow.Tasks.Workflows/SampleWf3.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc4 = CreateWorkflowConfiguration(wc4, "BasicHttpBinding_IFlowTasksOperations4", "http://localhost/Flow.Tasks.Workflows/SampleWf4.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc4a = CreateWorkflowConfiguration(wc4a, "BasicHttpBinding_IFlowTasksOperations4a", "http://localhost/Flow.Tasks.Workflows/SampleWf4a.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc5 = CreateWorkflowConfiguration(wc5, "BasicHttpBinding_IFlowTasksOperations5", "http://localhost/Flow.Tasks.Workflows/SampleWf5.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc6 = CreateWorkflowConfiguration(wc6, "BasicHttpBinding_IFlowTasksOperations6", "http://localhost/Flow.Tasks.Workflows/SampleWf6.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc7 = CreateWorkflowConfiguration(wc7, "BasicHttpBinding_IFlowTasksOperations7", "http://localhost/Flow.Tasks.Workflows/SampleWf7.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc8 = CreateWorkflowConfiguration(wc8, "BasicHttpBinding_IFlowTasksOperations8", "http://localhost/ServiceWorkflowsVB/SampleWf8.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfc9 = CreateWorkflowConfiguration(wc9, "BasicHttpBinding_IFlowTasksOperations9", "http://localhost/ServiceWorkflowsVB/SampleWf9.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfcSketch = CreateWorkflowConfiguration(wcSketch, "", "http://localhost/Flow.Tasks.Workflows/SketchWf.xamlx", "BasicHttpBinding_FlowTasks"); WorkflowConfiguration wfcHoliday = CreateWorkflowConfiguration(wcHoliday, "", "http://localhost/Flow.Tasks.Workflows/HolidayWf.xamlx", "BasicHttpBinding_FlowTasks"); context.WorkflowConfigurations.AddOrUpdate( wfc => wfc.ServiceUrl, wfc1, wfc2, wfc3, wfc4, wfc4a, wfc5, wfc6, wfc7, wfc8, wfc9, wfcSketch, wfcHoliday); // Topic TopicStatus topicNew = CreateTopicStatus("New", "New topic message"); TopicStatus topicRead = CreateTopicStatus("Read", "Read topic message"); context.TopicStatuses.AddOrUpdate( t => t.Status, topicNew, topicRead ); // Holiday HolidayType pubType = CreateHolidayType("Public", "Public holiday"); HolidayType anualType = CreateHolidayType("Annual", "Annual leave"); HolidayType sickType = CreateHolidayType("Sick", "Sick leave"); context.HolidayTypes.AddOrUpdate( h => h.Type, pubType, anualType, sickType ); Holiday h2014 = CreateHoliday(pubType, 2014, HolidayStatus.A.ToString(), "01/01/2014,27/01/2014,25/04/2014,09/06/2014,06/10/2014,25/12/2014,26/12/2014"); Holiday h2015 = CreateHoliday(pubType, 2015, HolidayStatus.A.ToString(), "01/01/2015,26/01/2015,25/04/2015,08/06/2015,05/10/2015,25/12/2015,28/12/2015"); Holiday h2016 = CreateHoliday(pubType, 2016, HolidayStatus.A.ToString(), "01/01/2016,26/01/2016,25/04/2016,13/06/2016,03/10/2016,26/12/2016,27/12/2016"); context.Holidays.AddOrUpdate( h => h.Year, h2014, h2015, h2016 ); // Sketch properties var sketchUrl = CreateProperty("SketchWorkflowUrl", "http://localhost/Flow.Tasks.Workflows/"); var sketchPath = CreateProperty("SketchWorkflowPath", @"C:\Dev\Codeplex\FlowTasks\src\Workflows\ServiceWorkflows\"); context.Properties.AddOrUpdate( p => p.Name, sketchUrl, sketchPath ); var sketchWfpUrl = CreateWorkflowProperty(sketchUrl, wcSketch); var sketchWfpPath = CreateWorkflowProperty(sketchPath, wcSketch); context.WorkflowProperties.AddOrUpdate( p => new { p.WorkflowCodeId, p.WorkflowPropertyId }, sketchWfpUrl, sketchWfpPath ); context.Database.ExecuteSqlCommand(REMOVE_PROC); context.Database.ExecuteSqlCommand(REPORT_TASK_TIME_PROC); context.Database.ExecuteSqlCommand(REPORT_USER_TASK_COUNT_PROC); context.Database.ExecuteSqlCommand(REPORT_USER_TASKS_PROC); context.Database.ExecuteSqlCommand(REPORT_WORKFLOW_TIME_PROC); context.Database.ExecuteSqlCommand(TOPIC_SEARCH_FUNC); }