public UnityDependencyResolver() { UnityService.Get().Container().Options.DefaultScopedLifestyle = new WebRequestLifestyle(); BootCommandProcessor.Run(); UnityService.Get().Register(typeof(IFunctionStrategyService <, ,>), typeof(FunctionStrategyService <, ,>)) .Register(typeof(IActionStrategyService <,>), typeof(ActionStrategyService <,>)) .Register <IGuestAutoMapperService, GuestAutoMapperService>() .Register <IBallroomAutoMapperService, BallroomAutoMapperService>() .Register <IExpenseAutoMapperService, ExpenseAutoMapperService>() .Register <IUndoCommandService, UndoCommandService>() .Register <IPdfAutoMapperService, PdfAutoMapperService>() .Register <ITasksAutoMapperService, TasksAutoMapperService>() .Register <ExpensesUndoStrategy>() .Register <GroupUndoStrategy>() .Register <PersonsUndoStrategy>() .Register <TaskUndoStrategy>() .Register <IEmailService, EmailService>(Lifestyle.Singleton) .Register <ITaskCardItemsService, TaskCardItemsService>() .Register(() => HttpContext.Current.GetOwinContext().Authentication, Lifestyle.Scoped) .Register <IUserStore <ApplicationUser> >(() => new UserStore <ApplicationUser>(new ApplicationDbContext()), Lifestyle.Scoped) .Register <ApplicationDbContext>(Lifestyle.Scoped) .Register <ApplicationSignInManager>(Lifestyle.Scoped) .Register <ApplicationUserManager>(Lifestyle.Scoped); UnityService.Get().Container().RegisterMvcControllers(Assembly.GetExecutingAssembly()); }
public void Execute() { UnityService.Get().Register <IAuthUserService, AuthUserService>() .Register <IOAuthUserService, OAuthUserService>() .Register <IAuthCookieService, AuthCookieService>(Lifestyle.Singleton) .Register <IUserService, UserService>(); }
public void ConfigureAuth(IAppBuilder app) { DataProtectionProvider = app.GetDataProtectionProvider(); app.CreatePerOwinContext(() => UnityService.Get().Container().GetInstance <ApplicationUserManager>()); app.CreatePerOwinContext(() => UnityService.Get().Container().GetInstance <ApplicationSignInManager>()); // enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider // configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // enables the application to validate the security stamp when the user logs in. // this is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity <ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); AddGoogleAuth(app); AddFacebookAuth(app); AddMicrosoftAuth(app); //AddTwitterAuth(app); }
public void Execute() { UnityService.Get().Register <IBallroomService, BallroomService>() .Register <IProcessLayoutService, ProcessLayoutService>() .Register <IProcessTableSeatsService, ProcessTableSeatsService>() .Register <ProcessTableItemStrategy>() .Register <ProcessBallroomItemStrategy>(); }
/// <summary> /// Initializes a new instance of the <see cref="SetCellValueToCommandParameterBehavior"/> class. /// </summary> public SetCellValueToCommandParameterBehavior() { try { _gridViewService = UnityService.Get().Resolve <IGridViewService>(); } catch { } }
public IEnumerable <object> GetServices(Type serviceType) { try { return(UnityService.Get().Container().GetAllInstances(serviceType)); } catch (Exception) { return(new List <object>()); } }
public void Dispose() { var container = UnityService.Get().Container(); if (container == null) { return; } container.Dispose(); }
public object GetService(Type serviceType) { try { return(UnityService.Get().Container().GetInstance(serviceType)); } catch (Exception) { return(null); } }
public void CreateCookie(string userName) { var userRepository = UnityService.Get().Container().GetInstance <IUserRepository>(); // because IAuthCookieService is singleton var user = userRepository.GetUserByName(userName); var userData = user.UserKey.ToString(); var authTicket = new FormsAuthenticationTicket(1, user.Username, DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes), false, userData); var encryptedTicket = FormsAuthentication.Encrypt(authTicket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); HttpContext.Current.Response.Cookies.Add(cookie); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var service = UnityService.Get().Container().GetInstance <ITaskCardItemsService>(); if (Items != null) { foreach (var item in Items) { if (service.Validate(item.Type, item.Value)) { continue; } yield return(new ValidationResult(string.Format("Invalid {0} format", item.Type), new[] { item.Type })); } } }
public static void Init() { var typeRegistry = UnityService.Get().Container().GetInstance <IXmlSerializationTypeRegistry>(); IEnumerable <Type> typesThatImplementIUndoCommand = null; try { typesThatImplementIUndoCommand = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(n => n.GetTypes()) .Where(n => n.IsClass && typeof(IUndoCommand).IsAssignableFrom(n)); } catch (ReflectionTypeLoadException ex) { _logger.Error(ex.Message, ex); } foreach (var type in typesThatImplementIUndoCommand) { typeRegistry.RegisterType(type); } }
public void Execute() { UnityService.Get().Register <IExpenseService, ExpenseService>(); }
internal static void Init() { UnityService.Get().Register <IUserRepository, UserRepository>() .Register <IOAuthWrapper, OAuthWrapper>() .Register <IMapperService, MapperService>(); }
public void Execute() { UnityService.Get().Register(typeof(IUnitOfWork <>), typeof(UnitOfWork <>), Lifestyle.Scoped); }
public void Execute() { UnityService.Get().Register <ITaskService, TaskService>(); }
public object Execute() { var service = UnityService.Get().Container().GetInstance <IUndoCommandService>(); return(service.Execute(UndoAction.GroupUndo, Group)); }
public void Execute() { UnityService.Get().Register <ITaskRepository, TaskRepository>(); }
public void Execute() { UnityService.Get().Register <IGroupService, GroupService>() .Register <IPersonService, PersonService>(); }
/// <summary> /// Creates the <see cref="T:Microsoft.Practices.Unity.IUnityContainer" /> that will be used as the default container. /// </summary> /// <returns> /// A new instance of <see cref="T:Microsoft.Practices.Unity.IUnityContainer" />. /// </returns> protected override IUnityContainer CreateContainer() { return(UnityService.Get().Container); }
public void Execute() { UnityService.Get().Register <IExpenseRepository, ExpenseRepository>() .Register <IBudgetRepository, BudgetRepository>(); }
public void Execute() { UnityService.Get().Register <IUndoRepository, UndoRepository>() .Register <IXmlSerializationTypeRegistry, XmlSerializationTypeRegistry>(Lifestyle.Singleton); }
public void Execute() { UnityService.Get().Register <IUndoService, UndoService>(); }
public void Execute() { UnityService.Get().Register <IGroupRepository, GroupRepository>(Lifestyle.Scoped); }
public void Execute() { UnityService.Get().Register <IBallroomRepository, BallroomRepository>(); }