Exemple #1
0
        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>();
 }
Exemple #3
0
        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 {
     }
 }
Exemple #6
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     try
     {
         return(UnityService.Get().Container().GetAllInstances(serviceType));
     }
     catch (Exception)
     {
         return(new List <object>());
     }
 }
Exemple #7
0
        public void Dispose()
        {
            var container = UnityService.Get().Container();

            if (container == null)
            {
                return;
            }

            container.Dispose();
        }
Exemple #8
0
 public object GetService(Type serviceType)
 {
     try
     {
         return(UnityService.Get().Container().GetInstance(serviceType));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #9
0
        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 }));
                }
            }
        }
Exemple #11
0
        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>();
 }
Exemple #13
0
 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);
 }
Exemple #15
0
 public void Execute()
 {
     UnityService.Get().Register <ITaskService, TaskService>();
 }
Exemple #16
0
        public object Execute()
        {
            var service = UnityService.Get().Container().GetInstance <IUndoCommandService>();

            return(service.Execute(UndoAction.GroupUndo, Group));
        }
Exemple #17
0
 public void Execute()
 {
     UnityService.Get().Register <ITaskRepository, TaskRepository>();
 }
 public void Execute()
 {
     UnityService.Get().Register <IGroupService, GroupService>()
     .Register <IPersonService, PersonService>();
 }
Exemple #19
0
 /// <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>();
 }
Exemple #21
0
 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);
 }
Exemple #24
0
 public void Execute()
 {
     UnityService.Get().Register <IBallroomRepository, BallroomRepository>();
 }