本文整理匯總了C#中BehaviorGraph.As方法的典型用法代碼示例。如果您正苦於以下問題:C# BehaviorGraph.As方法的具體用法?C# BehaviorGraph.As怎麽用?C# BehaviorGraph.As使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BehaviorGraph
的用法示例。
在下文中一共展示了BehaviorGraph.As方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ImportInto
public void ImportInto(BehaviorGraph graph)
{
// TODO -- will want this to suck in the configuration log business somehow
Registry.Compile();
BehaviorGraph childGraph = Registry.Configuration.BuildForImport(graph);
graph.As<IChainImporter>().Import(childGraph, b => {
b.PrependToUrl(Prefix);
b.Origin = Registry.Name;
});
}
示例2: ImportInto
public void ImportInto(BehaviorGraph parent, ConfigLog log)
{
var childGraph = BehaviorGraphBuilder.Import(Registry, parent, log);
parent.As<IChainImporter>().Import(childGraph, b => {
b.PrependToUrl(Prefix);
b.Origin = Registry.Name;
});
log.Import(Registry.Config, Provenance);
}
示例3: SetUp
public void SetUp()
{
var builder = new ContainerBuilder();
builder.RegisterType<FileSystem>().As<IFileSystem>();
builder.RegisterInstance(MockRepository.GenerateMock<IStreamingData>()).As<IStreamingData>();
builder.RegisterInstance(new NulloHttpWriter()).As<IHttpWriter>();
builder.RegisterInstance(new CurrentChain(null, null)).As<ICurrentChain>();
builder.RegisterInstance(
new StandInCurrentHttpRequest
{
ApplicationRoot = "http://server"
}).As<ICurrentHttpRequest>();
builder.RegisterInstance(MockRepository.GenerateMock<IResourceHash>()).As<IResourceHash>();
builder.RegisterType<AutofacContainerFacility>().As<IContainerFacility>();
context = builder.Build();
graph = BehaviorGraph.BuildFrom(
x =>
{
x.Route("/area/sub/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub2/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub3/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
});
facility = new AutofacContainerFacility(context);
graph.As<IRegisterable>().Register(facility.Register);
factory = facility.BuildFactory();
}
示例4: SetUp
public void SetUp()
{
container = new Container(x => x.For<IFileSystem>().Use<FileSystem>());
graph = new FubuRegistry(x =>
{
x.Route("/area/sub/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub2/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub3/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
}).BuildGraph();
facility = new StructureMapContainerFacility(container);
graph.As<IRegisterable>().Register(facility.Register);
factory = facility.BuildFactory(DiagnosticLevel.None);
}
示例5: SetUp
public void SetUp()
{
registry1 = new FubuRegistry();
registry1.Actions.IncludeType<RegistryImportEndpoint>();
theImport = new RegistryImport
{
Prefix = "area1",
Registry = registry1
};
graph2 = BehaviorGraph.BuildFrom(x => {
x.Actions.IncludeType<TestController>();
});
graph2.As<IChainImporter>().Import(theImport.BuildChains(graph2.Settings));
}
示例6: SetUp
public void SetUp()
{
container = new Container(x =>
{
x.For<IFileSystem>().Use<FileSystem>();
x.For<IStreamingData>().Use(MockRepository.GenerateMock<IStreamingData>());
x.For<IHttpWriter>().Use(new NulloHttpWriter());
x.For<ICurrentChain>().Use(new CurrentChain(null, null));
x.For<ICurrentHttpRequest>().Use(new StubCurrentHttpRequest("http://server"));
});
container.Configure(x => x.For<IContainerFacility>().Use<StructureMapContainerFacility>());
graph = new FubuRegistry(x =>
{
x.Route("/area/sub/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub2/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Route("/area/sub3/{Name}/{Age}")
.Calls<TestController>(c => c.AnotherAction(null)).OutputToJson();
x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
}).BuildGraph();
facility = new StructureMapContainerFacility(container);
graph.As<IRegisterable>().Register(DiagnosticLevel.None, facility.Register);
factory = facility.BuildFactory();
}
示例7: SetUp
public void SetUp()
{
container = new Container(x =>
{
x.For<IFileSystem>().Use<FileSystem>();
x.For<IHttpResponse>().Use(new OwinHttpResponse());
x.For<ICurrentChain>().Use(new CurrentChain(null, null));
x.For<IHttpRequest>().Use(OwinHttpRequest.ForTesting());
x.For<IResourceHash>().Use(MockRepository.GenerateMock<IResourceHash>());
});
container.Configure(x => x.For<IContainerFacility>().Use<StructureMapContainerFacility>());
graph = BehaviorGraph.BuildFrom(x => {
x.Actions.IncludeType<TestController>();
// x.Route("/area/sub/{Name}/{Age}")
// .Calls<TestController>(c => c.AnotherAction(null));
//
// x.Route("/area/sub2/{Name}/{Age}")
// .Calls<TestController>(c => c.AnotherAction(null));
//
// x.Route("/area/sub3/{Name}/{Age}")
// .Calls<TestController>(c => c.AnotherAction(null));
x.Models.ConvertUsing<ExampleConverter>().ConvertUsing<ExampleConverter2>();
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
x.Services(s => s.AddService<IActivator>(new StubActivator()));
});
facility = new StructureMapContainerFacility(container);
graph.As<IRegisterable>().Register(facility.Register);
factory = facility.BuildFactory();
}