Наследование: AbstractStreamResource
		public void MissingManifestResourceConfiguration()
		{
			var store = new DefaultConfigurationStore();
			var source = new AssemblyResource("assembly://Castle.Windsor.Tests/missing_config.xml");
			IKernel kernel = new DefaultKernel();
			new XmlInterpreter(source).ProcessResource(source, store, kernel);
		}
		public void SetUp()
		{
			var configurationStore = new DefaultConfigurationStore();
			var resource = new AssemblyResource("Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities117/facility.xml");
			var xmlInterpreter = new XmlInterpreter(resource);
			xmlInterpreter.ProcessResource(resource, configurationStore);
			facilityCfg = configurationStore.GetFacilityConfiguration("nhibernatefacility").Children["factory"];
		}
		public void AssemblyResourceAndIncludes()
		{
			IResource resource = new AssemblyResource("assembly://Castle.Windsor.Tests/Configuration2/resource_config_with_include.xml");

			container = new WindsorContainer(new XmlInterpreter(resource));

			AssertConfiguration();
		}
Пример #4
0
        static void Main(string[] args)
        {
            IResource resource = new AssemblyResource("assembly://CslaDemo.App/Configs/CastleActiveRecordImpl.config");
            //IResource resource = new AssemblyResource("assembly://CslaDemo.App/Configs/DefaultImpl.config");
            IWindsorContainer container = new WindsorContainer(new XmlInterpreter(resource));

            IRepository<UserEntity> userRepository = container.Resolve<IRepository<UserEntity>>();

            IContainerService<UserEntity, PostEntity> userPostContainer = container.Resolve<IContainerService<UserEntity, PostEntity>>();
            IContainerService<UserEntity, BlogEntity> userBlogContainer = container.Resolve<IContainerService<UserEntity, BlogEntity>>();

            IBusinessService<UserEntity> userService = container.Resolve<IBusinessService<UserEntity>>();
            userService.Initialize(container);

            UserEntity localUser = new UserEntity();
            localUser.Username = Guid.NewGuid().ToString();
            localUser.Password = "******";

            PostEntity p1 = new PostEntity
            {
                Category = "C1",
                Contents = "This is post 1",
                CreatedDate = DateTime.Now,
                Title = "Post1",
            };
            PostEntity p2 = new PostEntity
            {
                Category = "C2",
                Contents = "This is post 2",
                CreatedDate = DateTime.Now,
                Title = "Post2"
            };

            BlogEntity b1 = new BlogEntity
            {
                Author = "Huan",
                Name = "B1"
            };
            BlogEntity b2 = new BlogEntity
            {
                Author = "Huan",
                Name = "B2"
            };

            b1.Posts.Add(p1);
            b2.Posts.Add(p2);

            userBlogContainer.AddTo(localUser, b1, b2);

            userService.Save(localUser);
            Console.WriteLine("Insert... done");
            Console.ReadKey();

            userRepository.Delete(localUser);
            Console.WriteLine("Delete... done");
            Console.ReadKey();
        }
Пример #5
0
		public override void OnSetUp()
		{
			var configurationStore = new DefaultConfigurationStore();
			var resource = new AssemblyResource("Castle.Facilities.NHibernateIntegration.Tests/Issues/Facilities116/facility.xml");
			var xmlInterpreter = new XmlInterpreter(resource);
			xmlInterpreter.ProcessResource(resource, configurationStore);
			this.configuration = configurationStore.GetFacilityConfiguration("nhibernatefacility").Children["factory"];
			this.configurationBuilder = new PersistentConfigurationBuilder();
		}
Пример #6
0
		/// <summary>
		/// Depending on the resource type, <see cref="AssemblyResource"/> or <see cref="FileResource"/> is decorated.
		/// </summary>
		/// <param name="resource"></param>
		public FileAssemblyResource(string resource)
		{
			if(File.Exists(resource))
			{
				innerResource = new FileResource(resource);
			}
			else
			{
				innerResource = new AssemblyResource(resource);
			}

		}
Пример #7
0
		public XmlNavigableBuilder()
		{
			AssemblyResource resource = new AssemblyResource("assembly://Castle.MonoRail.View.Xslt/Castle.MonoRail.View.Xslt/InheritanceHelper.xslt");
			
			_dataStream = new MemoryStream();
			_textWriter = new XmlTextWriter(_dataStream, Encoding.Default);
			_textWriter.WriteStartDocument();
			_hierachyFixTransform = new XslCompiledTransform();
			using (XmlTextReader reader = new XmlTextReader(resource.GetStreamReader()))
            {
				_hierachyFixTransform.Load(reader);	
            }
	
		}
Пример #8
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var filename = "assembly://VendingMachine/windsor.config.xml";
            IResource resource = new AssemblyResource(filename);
            _container = new WindsorContainer(new XmlInterpreter(resource));

            //add all of the controllers to the container
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (typeof(IController).IsAssignableFrom(type))
                {
                    _container.Register(Component.For(type).LifestylePerWebRequest());
                }
            }

            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());
            RegisterRoutes(RouteTable.Routes);
        }
Пример #9
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var filename = "assembly://BookSample/windsor.config.xml";
            IResource resource = new AssemblyResource(filename);
            _container = new WindsorContainer(new XmlInterpreter(resource));

            //add all of the controllers to the container
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (typeof(IController).IsAssignableFrom(type))
                {
                    _container.Register(Component.For(type).LifestylePerWebRequest());
                }
            }

            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
Пример #10
0
		public static IResource Embedded(string name)
		{
			var uri = new CustomUri(EmbeddedPath(name));
			var resource = new AssemblyResource(uri);
			return resource;
		}
Пример #11
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var filename = "assembly://Rmsauto.Store.Web/windsor.config.xml";
            IResource resource = new AssemblyResource(filename);
            _container = new WindsorContainer(new XmlInterpreter(resource));
            RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //add all of the controllers to the container
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (typeof(IController).IsAssignableFrom(type))
                {
                    _container.Register(Component.For(type).LifestylePerWebRequest());
                }
            }

            ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());

            UrlManager.RegisterRoutes(RouteTable.Routes);
            new GlobalDBSettings.GlobalSettings().Init();

            #region === Каталогов Laximo на   пока не будет ===
            //try
            //{
            //    StringBuilder sb = new StringBuilder();
            //    sb.Append("Подгружаем каталоги Laximo." + Environment.NewLine);
            //    sb.Append("Путь к сертификату: " + CertPath + Environment.NewLine);
            //    sb.Append("Пароль к сертификату: " + CertPwd + Environment.NewLine);
            //    Logger.WriteInformation(sb.ToString(), EventLogerID.AdditionalLogic, EventLogerCategory.UnknownCategory);
            //}
            //catch { }
            //try
            //{
            //    Application["CatalogProvider"] = new CatalogProvider(CertPath, CertPwd, new CatalogCache());
            //}
            //catch (Exception ex)
            //{
            //    StringBuilder sb = new StringBuilder();
            //    sb.Append("При загрузке каталогов Laximo, произошло исключение!" + Environment.NewLine);
            //    sb.Append("----------------------------------------------------" + Environment.NewLine);
            //    sb.Append("exception message: " + Environment.NewLine);
            //    sb.Append(ex.Message);
            //    sb.Append("----------------------------------------------------" + Environment.NewLine);
            //    sb.Append("exception stacktrace: " + Environment.NewLine);
            //    sb.Append(ex.StackTrace);
            //    Logger.WriteError(sb.ToString(), EventLogerID.UnknownError, EventLogerCategory.UnknownCategory);
            //}
            #endregion
        }