Beispiel #1
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            using (var tran = RepositoryFactory.StartTransaction())
            {
                _setting1 = new AppSetting
                {
                    Id    = "setting1",
                    Value = "val1"
                };
                _setting2 = new AppSetting
                {
                    Id    = "setting2",
                    Value = "val2"
                };
                _emptySetting = new AppSetting
                {
                    Id    = "empty_setting",
                    Value = null
                };

                SessionFactory <AppSetting> .Store(_setting1);

                SessionFactory <AppSetting> .Store(_setting2);

                SessionFactory <AppSetting> .Store(_emptySetting);

                tran.Commit();
                var items = SessionFactory <AppSetting> .FindAll();
            }
        }
Beispiel #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     ApplicationInit.Init();
     Application.Run(new MainForm());
 }
Beispiel #3
0
 public void Init()
 {
     IoC.InitializeWith(new WindsorContainer());
     ApplicationInit.InitializeRepositories();
     base.SetUp();
     DBInit.RegisterDocumentStore(Store);
     DBInit.RegisterIndexes(Store);
 }
Beispiel #4
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _testFeed = new RssFeed
                {
                    Id                 = Guid.NewGuid(),
                    Name               = "feed1",
                    Url                = "some_test_url1",
                    AuthorRegex        = "author_regex",
                    DisplayFullContent = true,
                    GetDirectContent   = false,
                    ContentParseRegex  = "content_parser"
                };
                _testFeed.RssItems = new List <RssItem>
                {
                    new RssItem
                    {
                        Id          = Guid.NewGuid(),
                        RssFeed     = _testFeed,
                        Url         = "feed_url1",
                        Author      = "unknown",
                        Description = "Short_description",
                        Text        = "some_text",
                        CreatedDate = DateTime.Now,
                        Modified    = DateTime.Now,
                        PublishDate = DateTime.Now
                    }
                };

                SessionFactory <RssFeed> .Store(_testFeed);

                foreach (var rssItem in _testFeed.RssItems)
                {
                    SessionFactory <RssItem> .Store(rssItem);
                }
                tran.Commit();
            }
            WaitForIndexing();
        }
Beispiel #5
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                // create items as they can
                _messages = new[]
                {
                    new SystemMessage
                    {
                        Id                = Guid.NewGuid(),
                        CreatedDate       = new DateTime(2010, 10, 1),
                        Sender            = "test",
                        SystemMessageType = SystemMessageTypeEnum.Urgent,
                        Text              = "test_mesage1"
                    },
                    new SystemMessage
                    {
                        Id                = Guid.NewGuid(),
                        CreatedDate       = new DateTime(2010, 10, 2),
                        Sender            = "test",
                        SystemMessageType = SystemMessageTypeEnum.Warning,
                        Text              = "test_mesage2"
                    },
                    new SystemMessage
                    {
                        Id                = Guid.NewGuid(),
                        CreatedDate       = new DateTime(2010, 10, 3),
                        Sender            = "test",
                        SystemMessageType = SystemMessageTypeEnum.Error,
                        Text              = "test_mesage3"
                    }
                };
                foreach (var systemMessage in _messages)
                {
                    SessionFactory <SystemMessage> .Store(systemMessage);
                }
                tran.Commit();
            }
        }
Beispiel #6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //注入 Ioc
            var container = new UnityContainer();

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
            //automapper
            AutoMapperConfig.Initialize();
            //BundleTable.EnableOptimizations = true;

            Constants.Server   = ConfigurationManager.AppSettings["Server"];
            Constants.Database = ConfigurationManager.AppSettings["Database"];

            ApplicationInit.InitData();
        }
Beispiel #7
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            ApplicationInit.InitializeServices();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                RepositoryFactory.Action <IUserAction>().CreateAdmin("user", "*****@*****.**", "test");
                tran.Commit();
            }
            WaitForIndexing();
            using (RepositoryFactory.StartUnitOfWork())
            {
                _user = RepositoryFactory.Action <IUserAction>().GetByName("user");
            }
        }
Beispiel #8
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _user = new User()
                {
                    Id    = Guid.NewGuid(),
                    Name  = "user",
                    Email = "*****@*****.**"
                };
                _testText = new StaticText
                {
                    Id                 = Guid.NewGuid(),
                    Title              = "text3",
                    CreatedBy          = _user,
                    CreatedDate        = DateTime.Now,
                    ActualVersion      = 0,
                    PublishDate        = DateTime.Now,
                    Modified           = DateTime.Now,
                    AreCommentAllowed  = true,
                    StaticTextVersions = new List <StaticTextVersion>
                    {
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "only one version",
                            Version     = 0,
                            CreatedDate = new DateTime(2002, 1, 1)
                        },
                    }
                };
                _testText.Comments = new List <Comment>
                {
                    new Comment
                    {
                        Id              = Guid.NewGuid(),
                        Name            = "first_comment",
                        Content         = _testText,
                        Owner           = _user,
                        AnonymousName   = null,
                        CreatedDate     = new DateTime(2002, 1, 1),
                        ActualVersion   = 0,
                        CommentVersions = new List <CommentVersion>()
                        {
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 1, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.1.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen",
                                Version = 0
                            }
                        }
                    },
                    new Comment
                    {
                        Id              = Guid.NewGuid(),
                        Name            = "second_comment",
                        Content         = _testText,
                        Owner           = _user,
                        AnonymousName   = null,
                        CreatedDate     = new DateTime(2002, 1, 1).AddMinutes(1),
                        ActualVersion   = 1,
                        CommentVersions = new List <CommentVersion>()
                        {
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 1, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.1.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen",
                                Version = 0
                            },
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 2, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.2.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen - change",
                                Version = 1
                            }
                        }
                    }
                };

                _testText.Comments[0].TopComment = _testText.Comments[0];
                _testText.Comments[1].TopComment = _testText.Comments[1];
                SessionFactory <User> .Store(_user);

                SessionFactory <StaticText> .Store(_testText);

                foreach (var comment in _testText.Comments)
                {
                    SessionFactory <Comment> .Store(comment);
                }
                tran.Commit();
            }

            WaitForIndexing();
        }
Beispiel #9
0
 public void Init()
 {
     IoC.InitializeWith(new WindsorContainer());
     ApplicationInit.InitializeRepositories();
 }
Beispiel #10
0
 public ActionResult RefreshRightActions()
 {
     ApplicationInit.InitRightActions();
     return(Content("已成功更新权限操作数据", "text/html"));
 }
Beispiel #11
0
 public ActionResult InitActions()
 {
     ApplicationInit.InitActions();
     return(Content("已成功更新控制器动作数据", "text/html"));
 }
Beispiel #12
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _statuses = new[]
                {
                    new TwitterStatus
                    {
                        Id                = Guid.NewGuid(),
                        TwitterId         = 1,
                        Text              = "Status1",
                        User              = "******",
                        Hidden            = false,
                        CreatedDate       = new DateTime(2010, 10, 10),
                        Modified          = new DateTime(2010, 10, 10),
                        PublishDate       = new DateTime(2010, 10, 10),
                        Reply             = false,
                        RetweetUser       = null,
                        CreatedBy         = null,
                        AreCommentAllowed = false
                    },
                    new TwitterStatus
                    {
                        Id                = Guid.NewGuid(),
                        TwitterId         = 2,
                        Text              = "Status2",
                        User              = "******",
                        Hidden            = false,
                        CreatedDate       = new DateTime(2010, 10, 11),
                        Modified          = new DateTime(2010, 10, 11),
                        PublishDate       = new DateTime(2010, 10, 11),
                        Reply             = false,
                        RetweetUser       = null,
                        CreatedBy         = null,
                        AreCommentAllowed = false
                    },
                    new TwitterStatus
                    {
                        Id                = Guid.NewGuid(),
                        TwitterId         = 3,
                        Text              = "Status3",
                        User              = "******",
                        Hidden            = false,
                        CreatedDate       = new DateTime(2010, 10, 11).AddMinutes(1),
                        Modified          = new DateTime(2010, 10, 11),
                        PublishDate       = new DateTime(2010, 10, 11),
                        Reply             = false,
                        RetweetUser       = null,
                        CreatedBy         = null,
                        AreCommentAllowed = false
                    }
                };
                foreach (var twitterStatus in _statuses)
                {
                    SessionFactory <TwitterStatus> .Store(twitterStatus);
                }
                tran.Commit();
            }
            WaitForIndexing();
        }
Beispiel #13
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _user = new User()
                {
                    Id    = Guid.NewGuid(),
                    Name  = "user",
                    Email = "*****@*****.**"
                };
                var statText1 = new StaticText
                {
                    Id                 = Guid.NewGuid(),
                    Title              = "text1",
                    FriendlyUrl        = "text1",
                    CreatedBy          = _user,
                    CreatedDate        = DateTime.Now,
                    ActualVersion      = 1,
                    PublishDate        = new DateTime(2002, 1, 1),
                    Modified           = new DateTime(2002, 3, 1),
                    AreCommentAllowed  = true,
                    StaticTextVersions = new List <StaticTextVersion>
                    {
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "version0",
                            Version     = 0,
                            CreatedDate = new DateTime(2002, 1, 1)
                        },
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "version1",
                            Version     = 1,
                            CreatedDate = new DateTime(2002, 2, 1)
                        }
                    }
                };
                statText1.Comments = new List <Comment>
                {
                    new Comment
                    {
                        Id              = Guid.NewGuid(),
                        Name            = "first_comment",
                        Content         = statText1,
                        Owner           = _user,
                        AnonymousName   = null,
                        CreatedDate     = new DateTime(2002, 1, 1),
                        ActualVersion   = 0,
                        CommentVersions = new List <CommentVersion>()
                        {
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 1, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.1.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen",
                                Version = 0,
                            }
                        }
                    },
                    new Comment
                    {
                        Id              = Guid.NewGuid(),
                        Name            = "first_comment",
                        Content         = statText1,
                        Owner           = _user,
                        AnonymousName   = null,
                        CreatedDate     = new DateTime(2002, 1, 1),
                        ActualVersion   = 1,
                        CommentVersions = new List <CommentVersion>()
                        {
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 1, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.1.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen",
                                Version = 0
                            },
                            new CommentVersion
                            {
                                CreatedDate =
                                    new DateTime(2002,
                                                 2, 1),
                                CreatedBy = _user,
                                ClientIp  =
                                    "192.168.2.1",
                                UserAgent = "mozilla",
                                Text      =
                                    "this is unique commen - change",
                                Version = 1
                            }
                        }
                    }
                };
                var statText2 = new StaticText
                {
                    Id                 = Guid.NewGuid(),
                    Title              = "text2",
                    FriendlyUrl        = "text2",
                    CreatedBy          = _user,
                    CreatedDate        = DateTime.Now,
                    ActualVersion      = 2,
                    PublishDate        = new DateTime(2002, 2, 1),
                    Modified           = new DateTime(2002, 3, 1),
                    AreCommentAllowed  = true,
                    StaticTextVersions = new List <StaticTextVersion>
                    {
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "version0",
                            Version     = 0,
                            CreatedDate = new DateTime(2002, 1, 1)
                        },
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "version1",
                            Version     = 1,
                            CreatedDate = new DateTime(2002, 2, 1)
                        },
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "version2",
                            Version     = 2,
                            CreatedDate = new DateTime(2002, 3, 1)
                        }
                    }
                };
                var statText3 = new StaticText
                {
                    Id                 = Guid.NewGuid(),
                    Title              = "text3",
                    FriendlyUrl        = "text",
                    CreatedBy          = _user,
                    CreatedDate        = DateTime.Now,
                    ActualVersion      = 0,
                    PublishDate        = new DateTime(2002, 3, 1),
                    Modified           = new DateTime(2002, 3, 1),
                    AreCommentAllowed  = true,
                    StaticTextVersions = new List <StaticTextVersion>
                    {
                        new StaticTextVersion
                        {
                            CreatedBy   = _user,
                            Text        = "only one version",
                            Version     = 0,
                            CreatedDate = new DateTime(2002, 1, 1)
                        },
                    }
                };

                SessionFactory <User> .Store(_user);

                SessionFactory <StaticText> .Store(statText1);

                SessionFactory <StaticText> .Store(statText2);

                SessionFactory <StaticText> .Store(statText3);

                foreach (var comment in statText1.Comments)
                {
                    SessionFactory <Comment> .Store(comment);
                }
                _testData = new[] { statText1, statText2, statText3 };
                tran.Commit();
            }

            WaitForIndexing();
        }
Beispiel #14
0
        public void Init()
        {
            IoC.InitializeWith(new WindsorContainer());
            IoC.InitializeWith(new WindsorContainer());
            ApplicationInit.InitializeRepositories();
            base.SetUp();
            DBInit.RegisterDocumentStore(Store);
            DBInit.RegisterIndexes(Store);

            using (var tran = RepositoryFactory.StartTransaction())
            {
                _feed = new RssFeed
                {
                    Id   = Guid.NewGuid(),
                    Name = "feed",
                    Url  = "feed_url"
                };
                SessionFactory <RssFeed> .Store(_feed);

                _rssItems = new[]
                {
                    new RssItem
                    {
                        Id                = Guid.NewGuid(),
                        FeedItemId        = "1",
                        Title             = "title1",
                        Text              = "Text1",
                        Description       = "Description1",
                        Author            = "twit_user1",
                        Url               = "url1",
                        Hidden            = false,
                        CreatedDate       = new DateTime(2010, 10, 10),
                        Modified          = new DateTime(2010, 10, 10),
                        PublishDate       = new DateTime(2010, 10, 10),
                        CreatedBy         = null,
                        AreCommentAllowed = false,
                        RssFeed           = _feed
                    },
                    new RssItem
                    {
                        Id                = Guid.NewGuid(),
                        FeedItemId        = "2",
                        Title             = "title2",
                        Text              = "Text2",
                        Description       = "Description2",
                        Author            = "twit_user2",
                        Url               = "url2",
                        Hidden            = false,
                        CreatedDate       = new DateTime(2010, 10, 12),
                        Modified          = new DateTime(2010, 10, 12),
                        PublishDate       = new DateTime(2010, 10, 12),
                        CreatedBy         = null,
                        AreCommentAllowed = false,
                        RssFeed           = _feed
                    },
                    new RssItem
                    {
                        Id                = Guid.NewGuid(),
                        FeedItemId        = "3",
                        Title             = "title3",
                        Text              = "Text3",
                        Description       = "Description3",
                        Author            = "twit_user3",
                        Url               = "url3",
                        Hidden            = true,
                        CreatedDate       = new DateTime(2010, 10, 13),
                        Modified          = new DateTime(2010, 10, 13),
                        PublishDate       = new DateTime(2010, 10, 13),
                        CreatedBy         = null,
                        AreCommentAllowed = false,
                        RssFeed           = _feed
                    }
                };
                foreach (var rssItem in _rssItems)
                {
                    SessionFactory <RssItem> .Store(rssItem);
                }
                tran.Commit();
            }
            WaitForIndexing();
        }