当前位置: 首页>>代码示例>>C#>>正文


C# IObjectContainer类代码示例

本文整理汇总了C#中IObjectContainer的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer类的具体用法?C# IObjectContainer怎么用?C# IObjectContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IObjectContainer类属于命名空间,在下文中一共展示了IObjectContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XypericoDependencyResolver

        public XypericoDependencyResolver(IObjectContainer container)
        {
            Container = container;

              //
              //  Register all controller types so the container will be able to resolve them
              //
              Logger.Debug("Dependency resolver scanning for controllers");
              //foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
              foreach (Assembly a in BuildManager.GetReferencedAssemblies())
              {
            try
            {
              Logger.DebugFormat("Scanning assembly {0}", a.FullName);
              foreach (Type controllerType in (from t in a.GetTypes() where typeof(IController).IsAssignableFrom(t) select t))
              {
            Logger.DebugFormat("Adding {0} as a controller", controllerType);
            Container.AddTransientComponent(controllerType, controllerType);
            // OLD: AddComponentLifeStyle(controllerType.ToString(), controllerType, Castle.Core.LifestyleType.Transient);
              }
            }
            catch (ReflectionTypeLoadException ex)
            {
              Logger.Warn(string.Format("Could not load assembly {0}.", a.FullName), ex);
              foreach (Exception ex2 in ex.LoaderExceptions)
            Logger.Warn("Loader exception", ex2);

            }
            catch (Exception ex)
            {
              Logger.Warn(string.Format("Could not load assembly {0}.", a.FullName), ex);
            }
              }
        }
开发者ID:JornWildt,项目名称:Xyperico,代码行数:34,代码来源:XypericoDependencyResolver.cs

示例2: SetFirstCar

 public static void SetFirstCar(IObjectContainer db)
 {
     Pilot pilot = new Pilot("Rubens Barrichello", 99);
     Car car = new Car("BMW");
     car.Pilot = pilot;
     db.Store(car);
 }
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:ClientServerExample.cs

示例3: StoreData

 private static void StoreData(IObjectContainer container, Random rnd)
 {
     for (int i = 0; i < rnd.Next(4096); i++)
     {
         container.Store(new DataObject(rnd));
     }
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:7,代码来源:FreespaceMonitoring.cs

示例4: StoreOtherPeople

 private static void StoreOtherPeople(IObjectContainer container)
 {
     for (int i = 0; i < PopulationSize; i++)
     {
         container.Store(new Person("Citizen No " + i));
     }
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:7,代码来源:BigSetExample.cs

示例5: RetrieveAllPilots

 public static void RetrieveAllPilots(IObjectContainer db)
 {
     IQuery query = db.Query();
     query.Constrain(typeof(Pilot));
     IObjectSet result = query.Execute();
     ListResult(result);
 }
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:QueryExample.cs

示例6: StoreData

 private void StoreData(IObjectContainer container)
 {
     container.Store(new Person("Roman","Stoffel")
                         {
                             Address = new Address()
                                           {
                                               City = "Zurich",
                                               Street = "FunStreet"
                                           }
                         });    
     container.Store(new Person("Joe","Cool")
                         {
                             Address = new Address()
                                           {
                                               City = "FunTown",
                                               Street = "Fun Plaza"
                                           }
                         });
     container.Store(new Person("Joanna", "Awesome")
     {
         Address = new Address()
         {
             City = "More Fun Town",
             Street = "Plaza"
         }
     });          
 }
开发者ID:Galigator,项目名称:db4o,代码行数:27,代码来源:ReportForm.cs

示例7: ShowReport

        private void ShowReport(IObjectContainer container)
        {
            // #example: Run a report with db4o
            var dataToShow = from Person p in container
                             where p.FirstName.Contains("o")
                             select p;

            var reportViewer = new ReportViewer
            {
                ProcessingMode = ProcessingMode.Local
            };

            // Put the data into the datasource which you are using
            // in your report. Here it's named 'MainData'
            reportViewer.LocalReport.DataSources.Add(
                new ReportDataSource("MainData", dataToShow));
            reportViewer.Dock = DockStyle.Fill;

            // The report can be an embedded resource
            reportViewer.LocalReport.ReportEmbeddedResource = "Db4oDoc.Code.Reporting.ExampleReport.rdlc";
            // or can be a file
            // reportViewer.LocalReport.ReportPath = "path/to/your/report"; 

            // After that you can use the report viewer in your app
            this.Controls.Add(reportViewer);
            reportViewer.RefreshReport();
            // #end example
        }
开发者ID:Galigator,项目名称:db4o,代码行数:28,代码来源:ReportForm.cs

示例8: ActivateList

		static void ActivateList(IObjectContainer db, IList list)
		{
			foreach (var obj in list)
			{
				db.Activate(obj, int.MaxValue);
			}
		}
开发者ID:Boreeas,项目名称:LoLNotes,代码行数:7,代码来源:DbExporter.cs

示例9: RegisterDefaults

        public virtual void RegisterDefaults(IObjectContainer container)
        {
            var serviceProvider = container.Resolve<IServiceProvider>();
            RegisterVsDependencies(container, serviceProvider);

            container.RegisterTypeAs<InstallServices, InstallServices>();
            container.RegisterTypeAs<VsBrowserGuidanceNotificationService, IGuidanceNotificationService>();
            container.RegisterTypeAs<WindowsFileAssociationDetector, IFileAssociationDetector>();
            container.RegisterTypeAs<RegistryStatusAccessor, IStatusAccessor>();

            container.RegisterTypeAs<IntegrationOptionsProvider, IIntegrationOptionsProvider>();
            container.RegisterInstanceAs<IIdeTracer>(VsxHelper.ResolveMefDependency<IVisualStudioTracer>(serviceProvider));
            container.RegisterInstanceAs(VsxHelper.ResolveMefDependency<IProjectScopeFactory>(serviceProvider));

            container.RegisterTypeAs<TestRunnerEngine, ITestRunnerEngine>();
            container.RegisterTypeAs<TestRunnerGatewayProvider, ITestRunnerGatewayProvider>();
            container.RegisterTypeAs<MsTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2010MsTest.ToString());
            container.RegisterTypeAs<ReSharper5TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper5.ToString());
            container.RegisterTypeAs<ReSharper6TestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.ReSharper.ToString());
            container.RegisterTypeAs<SpecRunTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.SpecRun.ToString());
            container.RegisterTypeAs<VS2012RunnerGateway, ITestRunnerGateway>(TestRunnerTool.VisualStudio2012.ToString());
            container.RegisterTypeAs<AutoTestRunnerGateway, ITestRunnerGateway>(TestRunnerTool.Auto.ToString());

            container.RegisterTypeAs<StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>();
            container.RegisterTypeAs<DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>();
            container.RegisterTypeAs<StepTextAnalyzer, IStepTextAnalyzer>();

            RegisterCommands(container);
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:29,代码来源:VsContainerBuilder.cs

示例10: StoreExampleObjects

        // #end example

        private static void StoreExampleObjects(IObjectContainer container)
        {
            for (int i = 0; i < 100; i++)
            {
                container.Store(new Item(i));
            }
        }
开发者ID:superyfwy,项目名称:db4o,代码行数:9,代码来源:TraverseIndexExample.cs

示例11: Setup

        public static void Setup(IObjectContainer container)
        {
            Chimera.Authentication.Views.MongoDB.Utility.Initialize(container);

              container.AddComponent<INameValueContextCollection, CallContextNamedValueCollection>();
              container.AddComponent<IUserAccountViewBuilder, UserAccountViewBuilder>();
        }
开发者ID:JornWildt,项目名称:Chimera,代码行数:7,代码来源:SetupFixture.cs

示例12: FreespaceListener

 public FreespaceListener(IObjectContainer container)
 {
     _totalFreespaceCounter = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.TotalFreespace, container, false);
     _averageSlotSizeCounter = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.FreespaceAverageSlotSize, container, false);
     _freespaceSlotsCounter = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.FreespaceSlotCount, container, false);
     _reusedSlotsCounter = Db4oPerformanceCounters.CounterFor(PerformanceCounterSpec.FreespaceReusedSlotsPerSec, container, false);
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:7,代码来源:FreespaceMonitoringSupport.cs

示例13: Query

 public virtual IObjectSet Query(IObjectContainer db)
 {
     var query = db.Query();
     query.Constrain(this);
     query.Descend("_flag").Constrain(true).Not();
     return query.Execute();
 }
开发者ID:masroore,项目名称:db4o,代码行数:7,代码来源:ConjunctiveQbETestCase.cs

示例14: cadastrarStatus

 public Boolean cadastrarStatus(clsStatus objStatus)
 {
     try
     {
         if (!temDuplicidade(objStatus, "Cadastrar"))
         {
             objStatus.Codigo = obtemNovoId(); //Executa a solicitação de um novo id
             db = ServidorSingleton.obterServidor().OpenClient();
             db.Store(objStatus);
             db.Commit();
             return true;
         }
         else {
             return false;
         }
     }
     catch (Exception ex)
     {
         db.Rollback();
         throw new Exception("Erro cadastrando o status :" + ex.ToString());
     }
     finally {
         db.Close();
         db.Dispose();
     }
 }
开发者ID:fbsharp,项目名称:Projetos,代码行数:26,代码来源:StatusDAO.cs

示例15: SetUp

		public void SetUp()
		{
			_filePath = Path.GetTempFileName();
			//Db4objects.Db4o.Config.IConfiguration db4oConfiguration = Db4oFactory.Configure();
			//Db4objects.Db4o.Config.IObjectClass objectClass = db4oConfiguration.ObjectClass(typeof(LanguageForm));
			// objectClass.ObjectField("_writingSystemId").Indexed(true);
			// objectClass.ObjectField("_form").Indexed(true);

			_db = Db4oFactory.OpenFile(_filePath);
			((YapStream) _db).GetNativeQueryHandler().QueryOptimizationFailure +=
					OnQueryOptimizationFailure;

			for (int i = 0;i < 10000;i++)
			{
				Entry e = new Entry();
				e.name = new MultiText();
				e.name._forms[0] = new LanguageForm("en", "en-" + i);
				//e.name._forms[1] = new LanguageForm("fr", "fr-"+i);
				e.name._singleForm = new LanguageForm("en", i.ToString());
				_db.Set(e);
			}

			_db.Commit();
			_db.Dispose();
			_db = Db4oFactory.OpenFile(_filePath);
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:26,代码来源:Db4oQueryPerformance.cs


注:本文中的IObjectContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。