public static void Register(HttpConfiguration config) { var cors = new EnableCorsAttribute("http://src.streamus.com,http://dist.streamus.com,https://streamus.com,chrome-extension://jbnkffmindojffecdhbbmekbmkkfpmjd,chrome-extension://nnmcpagedcgekmljdamaeahfbmmjloho", "*", "*"); config.EnableCors(cors); AutofacRegistrations.RegisterAndSetResolver(config); }
public static void InitializeApplication() { //NHibernateProfiler.Initialize(); JsonMediaTypeFormatter json = GlobalConfiguration.Configuration.Formatters.JsonFormatter; json.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.All; // Don't serialize JSON empty strings into null -- instead turn them into empty strings because this is more intuitive and I don't want to have to do n ModelBinders.Binders.DefaultBinder = new JsonEmptyStringNotNullModelBinder(); AutofacRegistrations.RegisterAndSetResolver(); CreateAutoMapperMaps(); }
public void SetUp() { HttpConfiguration httpConfiguration = new HttpConfiguration(); AutofacRegistrations.RegisterAndSetResolver(httpConfiguration); HttpRequestMessage = new HttpRequestMessage(); HttpRequestMessage.SetConfiguration(httpConfiguration); IDependencyScope dependencyScope = HttpRequestMessage.GetDependencyScope(); Logger = (ILog)dependencyScope.GetService(typeof(ILog)); DaoFactory = (IDaoFactory)dependencyScope.GetService(typeof(IDaoFactory)); Session = (ISession)dependencyScope.GetService(typeof(ISession)); ManagerFactory = (IManagerFactory)dependencyScope.GetService(typeof(IManagerFactory)); Helpers = new Helpers(Session, ManagerFactory); }
public static void Register(HttpConfiguration config) { AutofacRegistrations.RegisterAndSetResolver(config); }