public SurveyContext Get() { var context = _requestSurveyContext.Get(); if (context == null) { context = new SurveyContext(); context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; context.Database.Log = Logger; _requestSurveyContext.Set(context); } return(context); }
public void InsertData() { const long surveyId = 1; if (_surveyRepository.Exists(surveyId)) { return; } //To Do var create = _surveyDesignFactory.Invoke(surveyId: surveyId, useDatabaseIds: true); var survey = create.Survey("Simple Survey", "f6e021af-a6a0-4039-83f4-152595b4671a"); _surveyRepository.Add(survey); _surveyContextProvider.Get().SaveChanges(); }