Example #1
0
		/// <summary>
		/// Registers application-level IoC settings.
		/// </summary>
		/// <param name="container"></param>
		public void RegisterServices(Container container)
		{
			container.RegisterWebApiRequestOrTransient<TodoListContext>();
			container.RegisterLazy<TodoListContext>();

			// Required: Register global datamodel metadata (IContainerMetadata and IContainerMetadata<DbContext>)
			var mmRegistration = Lifestyle.Singleton.CreateRegistration(() => new DbContextMetadata<TodoListContext>(new TodoListContext()), container);
			container.AddRegistration(typeof(IContainerMetadata), mmRegistration);
			container.AddRegistration(typeof(IContainerMetadata<TodoListContext>), mmRegistration);
			
			// Query validation settings could be specified here
			container.RegisterSingleton(new ODataValidationSettings()
			{
				MaxExpansionDepth = 5
			});
		}
Example #2
0
		/// <summary>
		/// Registers application-level IoC settings.
		/// </summary>
		/// <param name="container"></param>
		public void RegisterServices(Container container)
		{
			container.RegisterWebApiRequestOrTransient<ScrumDb>();
			container.RegisterLazy<ScrumDb>();

			// Required: Register global datamodel metadata (IContainerMetadata and IContainerMetadata<DbContext>)
			var mmRegistration = Lifestyle.Singleton.CreateRegistration(() => new DbContextMetadata<ScrumDb>(new ScrumDb()), container);
			container.AddRegistration(typeof(IContainerMetadata), mmRegistration);
			container.AddRegistration(typeof(IContainerMetadata<ScrumDb>), mmRegistration);

			// Query validation settings could be specified here
			container.RegisterSingleton(new ODataValidationSettings()
			                            {
				                            MaxExpansionDepth = 5,
				                            MaxTop = 200
			                            }); //.Named<ODataValidationSettings>("Edit");  TODO: Figure out how to separate ODataValidationSettings for Edit controllers vs ReadOnly controllers
		}
Example #3
0
		public void RegisterServices(Container container)
		{
			container.RegisterWebApiRequestOrTransient<EStoreDb>();
			container.RegisterLazy<EStoreDb>();

			// Required: Register global datamodel metadata
			var mmRegistration = Lifestyle.Singleton.CreateRegistration<DbContextMetadata<EStoreDb>>(container);
			container.AddRegistration(typeof(IContainerMetadata), mmRegistration);
			container.AddRegistration(typeof(IContainerMetadata<EStoreDb>), mmRegistration);

			// Query validation settings could be specified here
			container.RegisterSingleton(new ODataValidationSettings()
			                            {
				                            MaxExpansionDepth = 5,
				                            MaxTop = 200
			                            });
		}