Exemple #1
0
		public void Init()
		{
			if (_initialized)
			{
				return;
			}

            var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container);

			composite.RegisterNh(
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("test-db")), true, false);

			var compositeAppSettings = new CompositeAppSettings();

            compositeAppSettings.OutputChannel.ApplyOverride(typeof(AzureMessageChannel));
			compositeAppSettings.BlobStorage.WithDefault(typeof(AzureBlobStorage));
			compositeAppSettings.CommandPublicationRecordMapper.WithDefault(typeof(NhRecordMapper<CommandPublicationRecord>));

			composite.Configure(compositeAppSettings);

			/* EUCLID: Install agents and Input models */
            composite.AddAgent(typeof(TestCommand).Assembly);

			container.Register(Component.For<ICompositeApp>().Instance(composite));

			setAzureCredentials(container);

			_initialized = true;
		}
Exemple #2
0
		protected void Application_Start()
		{
			AreaRegistration.RegisterAllAreas();

			RegisterGlobalFilters(GlobalFilters.Filters);

			RegisterRoutes(RouteTable.Routes);

			var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container);

			var euclidCompositeConfiguration = new CompositeAppSettings();

			/*
             * jt: this is how a composite developer would override the default settings for the mvc composite
             * euclidCompositeConfiguration.BlobStorage.ApplyOverride(typeof(SomeBlobStorageImplementation));
             */

			composite.Configure(euclidCompositeConfiguration);

			composite.AddAgent(typeof (FakeCommand).Assembly);

			composite.RegisterInputModel(new InputToFakeCommand4Converter());

			container.Register(Component.For<ICompositeApp>().Instance(composite));

			Error += composite.LogUnhandledException;

			BeginRequest += composite.BeginPageRequest;
		}
Exemple #3
0
		public void Init()
		{
			if (_initialized)
			{
				return;
			}

			if (!RoleEnvironment.IsAvailable)
			{
				NConfigurator.UsingFile(@"~\Config\custom.config").SetAsSystemDefault();
				XmlConfigurator.Configure(new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0]))); ;
			}
			else
			{
				XmlConfigurator.Configure();
			}

			var compositeDatabaseConnection =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("test-db"));

			var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container)
				{ Name = "Test Composite", Description = "A composite application that is used to validate the Euclid platform" };

			var compositeAppSettings = new CompositeAppSettings();

			compositeAppSettings.OutputChannel.ApplyOverride(typeof(AzureMessageChannel));
			compositeAppSettings.BlobStorage.WithDefault(typeof(AzureBlobStorage));
			compositeAppSettings.CommandPublicationRecordMapper.WithDefault(typeof(NhRecordMapper<CommandPublicationRecord>));

			composite.Configure(compositeAppSettings);

			composite.AddAgent(typeof(TestCommand).Assembly);
			composite.AddAgent(typeof(LogQueries).Assembly);

			composite.RegisterInputModelMap<TestInputModel, TestCommand>(); // (new TestInputModelToCommandConverter());
			composite.RegisterInputModelMap<FailingInputModel, FailingCommand>(); // (new FailingInputModelToCommandConverter());
			composite.RegisterInputModelMap<ComplexInputModel, ComplexCommand>(
				i => new ComplexCommand { StringValue = i.StringValue, StringLength = i.StringValue.Length });
			setAzureCredentials(container);

			composite.RegisterNh(compositeDatabaseConnection, true);

			// composite.CreateSchema(compositeDatabaseConnection);

			_initialized = true;
		}
Exemple #4
0
		public void Init()
		{
			if (_initialized)
			{
				return;
			}

			if (!RoleEnvironment.IsAvailable)
			{
				NConfigurator.UsingFile(@"~\Config\custom.config").SetAsSystemDefault();
				XmlConfigurator.Configure(new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0])));
			}
			else
			{
				XmlConfigurator.Configure();
			}

			var databaseConfiguration =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("storefront-db"));

			var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container) { Name = "Newco Storefront Admin", Description = "Create and manage custom storefronts." };

			composite.RegisterNh(databaseConfiguration, true);

			var compositeAppSettings = new CompositeAppSettings();

			compositeAppSettings.OutputChannel.WithDefault(typeof(AzureMessageChannel));
			compositeAppSettings.BlobStorage.WithDefault(typeof(AzureBlobStorage));
			compositeAppSettings.CommandPublicationRecordMapper.WithDefault(typeof(NhRecordMapper<CommandPublicationRecord>));

			composite.Configure(compositeAppSettings);

			composite.CreateSchema(databaseConfiguration, false);

			composite.AddAgent(typeof(RegisterNewCompany).Assembly);
			composite.AddAgent(typeof(LogQueries).Assembly);

			// register input model maps

			setAzureCredentials(container);

			_initialized = true;
		}
Exemple #5
0
		public void Init()
		{
			if (_initialized)
			{
				return;
			}

			if (!RoleEnvironment.IsAvailable)
			{
				NConfigurator.UsingFile(@"~\Config\custom.config").SetAsSystemDefault();
				XmlConfigurator.Configure(new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0]))); ;
			}
			else
			{
				XmlConfigurator.Configure();
			}

			var databaseConfiguration =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("forum-db"));

			var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container)
			                	{Name = "NewCo Forum", Description = " A highly customizable managed forum."};

			composite.RegisterNh(databaseConfiguration, true);

			var compositeAppSettings = new CompositeAppSettings();

			compositeAppSettings.OutputChannel.WithDefault(typeof(AzureMessageChannel));
			compositeAppSettings.BlobStorage.WithDefault(typeof (AzureBlobStorage));
			compositeAppSettings.CommandPublicationRecordMapper.WithDefault(typeof (NhRecordMapper<CommandPublicationRecord>));

			composite.Configure(compositeAppSettings);

			composite.AddAgent(typeof (PublishPost).Assembly);
			composite.AddAgent(typeof (LogQueries).Assembly);

			composite.RegisterInputModelMap<CommentOnPostInputModel, CommentOnPost>();
			composite.RegisterInputModelMap<PublishPostInputModel, PublishPost>();
			composite.RegisterInputModelMap<RegisterForumUserInputModel, RegisterForumUser>(
				m =>
				new RegisterForumUser
					{
						ForumIdentifier = m.ForumIdentifier,
						FirstName = m.FirstName,
						LastName = m.LastName,
						PasswordHash = m.Password,
						PasswordSalt = m.Password,
						Username = m.Username,
						Email = m.Email
					});
			composite.RegisterInputModelMap<UpdateUserProfileInputModel, UpdateUserProfile>();
			composite.RegisterInputModelMap<VoteOnCommentInputModel, VoteOnComment>();
			composite.RegisterInputModelMap<VoteOnPostInputModel, VoteOnPost>();
			composite.RegisterInputModelMap<MarkPostAsFavoriteInputModel, MarkPostAsFavorite>();
			composite.RegisterInputModelMap<MarkCommentAsFavoriteInputModel, MarkCommentAsFavorite>();
			composite.RegisterInputModelMap<AddForumUserAsFriendInputModel, AddForumUserAsFriend>();
			composite.RegisterInputModelMap<RemoveForumUserFriendInputModel, RemoveForumUserFriend>();

			composite.CreateSchema(databaseConfiguration, false);

			setAzureCredentials(container);

			_initialized = true;
		}
Exemple #6
0
		public void Init()
		{
			if (_initialized)
			{
				return;
			}

			if (!RoleEnvironment.IsAvailable)
			{
				NConfigurator.UsingFile(@"~\Config\custom.config").SetAsSystemDefault();
				XmlConfigurator.Configure(new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0]))); ;
			}
			else
			{
				XmlConfigurator.Configure();
			}

			var databaseConfiguration =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("forum-db"));

			var container = new WindsorContainer();

			var composite = new MvcCompositeApp(container) {Name = "Newco Forum Admin", Description = "Create and manage custom forums."};

			composite.RegisterNh(databaseConfiguration, true);

			var compositeAppSettings = new CompositeAppSettings();

			compositeAppSettings.OutputChannel.WithDefault(typeof(AzureMessageChannel));
			compositeAppSettings.BlobStorage.WithDefault(typeof (AzureBlobStorage));
			compositeAppSettings.CommandPublicationRecordMapper.WithDefault(typeof (NhRecordMapper<CommandPublicationRecord>));

			composite.Configure(compositeAppSettings);

			composite.CreateSchema(databaseConfiguration, false);

			composite.AddAgent(typeof (PublishPost).Assembly);
			composite.AddAgent(typeof (LogQueries).Assembly);

			composite.RegisterInputModelMap<CreateForumInputModel, CreateForum>(
				input => new CreateForum
				         	{
				         		CreatedBy = input.CreatedBy,
				         		Description = input.Description,
				         		Name = input.Name,
				         		OrganizationId = input.OrganizationId,
				         		UpDownVoting = input.VotingScheme == VotingScheme.UpDownVoting,
				         		UrlHostName = input.UrlHostName,
				         		UrlSlug = input.UrlSlug,
				         		Moderated = input.Moderated,
				         		Private = input.Private,
				         		Theme = input.Theme
				         	}
				);
			composite.RegisterInputModelMap<CreateOrganizationAndRegisterUserInputModel, CreateOrganizationAndRegisterUser>(
				input =>
				new CreateOrganizationAndRegisterUser
					{
						Address = input.Address,
						Address2 = input.Address2,
						City = input.City,
						Country = input.Country,
						Email = input.Email,
						FirstName = input.FirstName,
						LastName = input.LastName,
						Username = input.Username,
						OrganizationName = input.OrganizationName,
						OrganizationSlug = input.OrganizationSlug,
						OrganizationUrl = input.OrganizationUrl,
						PhoneNumber = input.PhoneNumber,
						State = input.State,
						Zip = input.Zip,
						// TODO: salt & hash password
						PasswordHash = input.Password,
						PasswordSalt = input.Password
					});
			composite.RegisterInputModelMap<RegisterOrganizationUserInputModel, RegisterOrganizationUser>();
			composite.RegisterInputModelMap<UpdateOrganizationUserInputModel, UpdateOrganizationUser>(
				input =>
				new UpdateOrganizationUser
					{
						Created = DateTime.Now,
						Email = input.Email,
						FirstName = input.FirstName,
						LastName = input.LastName,
						OrganizationId = input.OrganizationId,
						UserId = input.UserId,
						Username = input.Username
					});
			composite.RegisterInputModelMap<UpdateOrganizationInputModel, UpdateOrganization>();
			composite.RegisterInputModelMap<UpdateForumInputModel, UpdateForum>();
			composite.RegisterInputModelMap<RegisterForumUserInputModel, RegisterForumUser>(input => new RegisterForumUser
			                                                                                         	{
			                                                                                         		ForumIdentifier =
			                                                                                         			input.ForumIdentifier,
			                                                                                         		FirstName =
			                                                                                         			input.FirstName,
			                                                                                         		LastName = input.LastName,
			                                                                                         		Email = input.Email,
			                                                                                         		Username = input.Username,
			                                                                                         		PasswordHash =
			                                                                                         			input.Password,
			                                                                                         		PasswordSalt =
			                                                                                         			input.Password,
			                                                                                         		CreatedBy =
			                                                                                         			input.CreatedBy
			                                                                                         	});
			composite.RegisterInputModelMap<CreateTagInputModel, CreateTag>();
			composite.RegisterInputModelMap<CreateStopWordInputModel, CreateStopWord>();
			composite.RegisterInputModelMap<UpdateTagInputModel, UpdateTag>();
			composite.RegisterInputModelMap<CreateCategoryInputModel, CreateCategory>();
			composite.RegisterInputModelMap<UpdateCategoryInputModel, UpdateCategory>();
			composite.RegisterInputModelMap<CreateForumContentInputModel, CreateForumContent>();
			composite.RegisterInputModelMap<UpdateForumContentInputModel, UpdateForumContent>();
			composite.RegisterInputModelMap<ForumThemeInputModel, SetForumTheme>(input=>new SetForumTheme
			                                                                            	{
			                                                                            		ForumIdentifier = input.ForumIdentifier,
																								ThemeName = input.SelectedTheme
			                                                                            	});
			composite.RegisterInputModelMap<CreateBadgeInputModel, CreateBadge>();
			composite.RegisterInputModelMap<UpdateBadgeInputModel, UpdateBadge>();
			composite.RegisterInputModelMap<CreateForumAvatarInputModel, CreateAvatar>();
			composite.RegisterInputModelMap<UpdateForumAvatarInputModel, UpdateAvatar>();
			composite.RegisterInputModelMap<ActivateAvatarInputModel, ActivateAvatar>();
			composite.RegisterInputModelMap<ActivateBadgeInputModel, ActivateBadge>();
			composite.RegisterInputModelMap<ActivateCategoryInputModel, ActivateCategory>();
			composite.RegisterInputModelMap<ActivateTagInputModel, ActivateTag>();
			composite.RegisterInputModelMap<ActivateStopWordInputModel, ActivateStopWord>();
			composite.RegisterInputModelMap<ActivateContentInputModel, ActivateContent>();
			composite.RegisterInputModelMap<DeleteContentInputModel, DeleteForumContent>();
			composite.RegisterInputModelMap<DeleteStopWordInputModel, DeleteStopWord>();
			composite.RegisterInputModelMap<ActivateUserInputModel, ActivateForumUser>();
			composite.RegisterInputModelMap<BlockUserInputModel, BlockUser>();
			composite.RegisterInputModelMap<UnblockUserInputModel, UnblockUser>();
			composite.RegisterInputModelMap<UpdateForumVotingSchemeInputModel, UpdateForumVotingScheme>(
																							input => new UpdateForumVotingScheme
																							{
																								ForumIdentifier = input.ForumIdentifier,
																								NoVoting = input.SelectedScheme == VotingScheme.NoVoting,
																								UpDownVoting = input.SelectedScheme == VotingScheme.UpDownVoting
																							});
			composite.RegisterInputModelMap<ActivateOrganizationUserInputModel, ActivateOrganizationUser>();
			composite.RegisterInputModelMap<ApprovePostInputModel, ApprovePost>();
			composite.RegisterInputModelMap<RejectPostInputModel, RejectPost>();
			composite.RegisterInputModelMap<ApproveCommentInputModel, ApproveComment>(input=>new ApproveComment
			                                                                                 	{
			                                                                                 		ApprovedBy = input.ApprovedBy,
																									CommentIdentifier = input.PostIdentifier,
																									CreatedBy = input.CreatedBy
			                                                                                 	});
			composite.RegisterInputModelMap<RejectCommentInputModel, RejectComment>(input=>new RejectComment
			                                                                               	{
			                                                                               		CommentIdentifier = input.PostIdentifier,
																								CreatedBy = input.CreatedBy
			                                                                               	});
			composite.RegisterInputModelMap<DeleteOrganizationUserInputModel, DeleteOrganizationUser>();
			composite.RegisterInputModelMap<DeleteForumUserInputModel, DeleteForumUser>();
			composite.RegisterInputModelMap<DeleteAvatarInputModel, DeleteAvatar>();

			setAzureCredentials(container);
			_initialized = true;
		}