本文整理汇总了C#中IObjectContainer类的典型用法代码示例。如果您正苦于以下问题:C# IObjectContainer类的具体用法?C# IObjectContainer怎么用?C# IObjectContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectContainer类属于命名空间,在下文中一共展示了IObjectContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: OnStore
public virtual object OnStore(IObjectContainer container, object applicationObject
)
{
var t = (Thing) applicationObject;
AddToCache(t);
return t.name;
}
开发者ID:masroore,项目名称:db4o,代码行数:7,代码来源:ObjectTranslatorTestCase.cs
示例15: RootContainer
private static IObjectContainer RootContainer()
{
lock (sync)
{
return database ?? (database = CreateRootContainer());
}
}
开发者ID:Galigator,项目名称:db4o,代码行数:7,代码来源:Db4oEmbedded.cs
示例16: MockMarshallingContext
public MockMarshallingContext(IObjectContainer objectContainer)
{
_objectContainer = objectContainer;
_header = new ByteArrayBuffer(1000);
_payLoad = new ByteArrayBuffer(1000);
_current = _header;
}
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:MockMarshallingContext.cs
示例17: SetSecondCar
public static void SetSecondCar(IObjectContainer db)
{
Pilot pilot = new Pilot("Michael Schumacher", 100);
Car car = new Car("Ferrari");
car.Pilot = pilot;
db.Store(car);
}
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:ClientServerExample.cs
示例18: TestRunnerManager
public TestRunnerManager(IObjectContainer globalContainer, IContainerBuilder containerBuilder, RuntimeConfiguration runtimeConfiguration, IRuntimeBindingRegistryBuilder bindingRegistryBuilder)
{
this.globalContainer = globalContainer;
this.containerBuilder = containerBuilder;
this.runtimeConfiguration = runtimeConfiguration;
this.bindingRegistryBuilder = bindingRegistryBuilder;
}
开发者ID:tmulkern,项目名称:SpecFlow,代码行数:7,代码来源:TestRunnerManager.cs
示例19: ConfigureContainer
public static void ConfigureContainer(IObjectContainer container, ApplicationConfiguration config)
{
if (config == null || config.ContainerConfiguration == null) return;
if (container == null) return;
foreach (object item in config.ContainerConfiguration.Items)
{
ObjectContainerAdd add = item as ObjectContainerAdd;
if (item != null)
{
Type tKey = Type.GetType(add.KeyType, true, true);
Type tObj = Type.GetType(add.ObjectType, true, true);
container.Register(tKey, Activator.CreateInstance(tObj));
continue;
}
ObjectContainerRemove remove = item as ObjectContainerRemove;
if (item != null)
{
throw new NotImplementedException("Removing an object is not supported yet.");
}
ObjectContainerClear clear = item as ObjectContainerClear;
if (item != null)
{
container.Clear();
continue;
}
}
}
开发者ID:SignedUp,项目名称:omni-foundation,代码行数:31,代码来源:ConfigManager.cs
示例20: 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
注:本文中的IObjectContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论