Пример #1
0
        public MagistrateSystem(MagistrateConfiguration config)
        {
            _config = config;

            var container = new Container(new MagistrateRegistry(config.EventStore));

            container
                .GetInstance<Boot>()
                .Load();

            _container = container;
        }
Пример #2
0
        static void Main(string[] args)
        {
            var host = WebApp.Start("http://localhost:4444", app =>
            {
                Log.Logger = new LoggerConfiguration()
                    .MinimumLevel.Debug()
                    .WriteTo.ColoredConsole()
                    .CreateLogger();

                //add a login provider here
                //app.Use<WindowsAuthentication>();

                Directory.CreateDirectory("store");

                var config = new MagistrateConfiguration
                {
                    EventStore = new FileEventStore("store"),
                    User = () =>
                    {
                        //e.g. take user from ClaimsPrincipal:

                        //var current = ClaimsPrincipal.Current;
                        //return new MagistrateUser
                        //{
                        //	Name = current.Identity.Name,
                        //	Key = current.Identity.Name.ToLower().Replace(" ", "")
                        //};

                        return new Operator
                        {
                            Name = "Andy Dote",
                            Key = "andy-dote",
                            CanCreatePermissions = true,
                            CanCreateRoles = true,
                            CanCreateUsers = true,
                        };
                    }
                };

                var sys = new MagistrateSystem(config);
                sys.Configure(app);

                var ui = new MagistrateWebInterface();
                ui.Configure(app);

            });

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

            host.Dispose();
        }