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


C# IResolver.Resolve方法代码示例

本文整理汇总了C#中IResolver.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IResolver.Resolve方法的具体用法?C# IResolver.Resolve怎么用?C# IResolver.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IResolver的用法示例。


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

示例1: LcdpServer

        public LcdpServer(ILcdpPacketSerializer lcdpPacketSerializer, IListener listener, IForwarder forwarder, IResolver resolver)
        {
            this.lcdpPacketSerializer = lcdpPacketSerializer;

            this.listener = listener;
            this.forwarder = forwarder;

            this.messages = new ConcurrentDictionary<string, LcdpMessage>();

            this.ChunkExpirationTimeMilliseconds = 5000;

            this.compressors = new Dictionary<byte, ICompressor>();
            this.serializers = new Dictionary<byte, ISerializer>();

            for(byte b = 0; b < byte.MaxValue; ++b)
            {
                ICompressor compressor = resolver.Resolve<ICompressor>(b.ToString());
                if (compressor != null)
                {
                    compressors[b] = compressor;
                }

                ISerializer serializer = resolver.Resolve<ISerializer>(b.ToString());
                if (serializer != null)
                {
                    serializers[b] = serializer;
                }
            }
        }
开发者ID:DropZone,项目名称:LogC,代码行数:29,代码来源:LcdpServer.cs

示例2: ExecuteAsync

        public async Task ExecuteAsync(IResolver resolver, CancellationToken cancellationToken)
        {
            var queryProcessor = resolver.Resolve<IQueryProcessor>();
            var updateItineraryService = resolver.Resolve<IUpdateItineraryService>();
            var commandBus = resolver.Resolve<ICommandBus>();
            var routingService = resolver.Resolve<IRoutingService>();

            var cargo = (await queryProcessor.ProcessAsync(new GetCargosQuery(CargoId), cancellationToken).ConfigureAwait(false)).Single();
            var updatedItinerary = await updateItineraryService.UpdateItineraryAsync(cargo.Itinerary, cancellationToken).ConfigureAwait(false);

            if (cargo.Route.Specification().IsSatisfiedBy(updatedItinerary))
            {
                await commandBus.PublishAsync(new CargoSetItineraryCommand(cargo.Id, updatedItinerary), cancellationToken).ConfigureAwait(false);
                return;
            }

            var newItineraries = await routingService.CalculateItinerariesAsync(cargo.Route, cancellationToken).ConfigureAwait(false);

            var newItinerary = newItineraries.FirstOrDefault();
            if (newItinerary == null)
            {
                // TODO: Tell domain that a new itinerary could not be found
                throw DomainError.With("Could not find itinerary");
            }

            await commandBus.PublishAsync(new CargoSetItineraryCommand(cargo.Id, newItinerary), cancellationToken).ConfigureAwait(false);
        }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:27,代码来源:VerifyCargoItineraryJob.cs

示例3: Create

        public static PublishCommandJob Create(
            ICommand command,
            IResolver resolver)
        {
            var commandDefinitionService = resolver.Resolve<ICommandDefinitionService>();
            var jsonSerializer = resolver.Resolve<IJsonSerializer>();

            return Create(command, commandDefinitionService, jsonSerializer);
        }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:9,代码来源:PublishCommandJob.cs

示例4: ExecuteAsync

        public Task ExecuteAsync(IResolver resolver, CancellationToken cancellationToken)
        {
            var commandDefinitionService = resolver.Resolve<ICommandDefinitionService>();
            var jsonSerializer = resolver.Resolve<IJsonSerializer>();
            var commandBus = resolver.Resolve<ICommandBus>();

            var commandDefinition = commandDefinitionService.GetDefinition(Name, Version);
            var command = (ICommand) jsonSerializer.Deserialize(Data, commandDefinition.Type);

            return command.PublishAsync(commandBus, cancellationToken);
        }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:11,代码来源:PublishCommandJob.cs

示例5: ExecuteAsync

        public async Task ExecuteAsync(IResolver resolver, CancellationToken cancellationToken)
        {
            // Consideration: Fetching all cargos that are affected by an updated
            // schedule could potentially fetch several thousands. Each of these
            // potential re-routes would then take a considerable amount of time
            // and will thus be required to be executed in parallel

            var queryProcessor = resolver.Resolve<IQueryProcessor>();
            var jobScheduler = resolver.Resolve<IJobScheduler>();

            var cargos = await queryProcessor.ProcessAsync(new GetCargosDependentOnVoyageQuery(VoyageId), cancellationToken).ConfigureAwait(false);
            var jobs = cargos.Select(c => new VerifyCargoItineraryJob(c.Id));

            await Task.WhenAll(jobs.Select(j => jobScheduler.ScheduleNowAsync(j, cancellationToken))).ConfigureAwait(false);
        }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:15,代码来源:VerifyCargosForVoyageJob.cs

示例6: SetUp

        public void SetUp()
        {

            var codeBase = ReflectionHelper.GetCodeBase(GetType().Assembly);
            var filesEventStoreDirectory = Path.GetFullPath(Path.Combine(codeBase, "..", "..", "TestData", "FilesEventStore"));

            _resolver = EventFlowOptions.New
                .UseFilesEventStore(FilesEventStoreConfiguration.Create(filesEventStoreDirectory))
                .AddEvents(EventFlowTestHelpers.Assembly)
                .AddCommandHandlers(EventFlowTestHelpers.Assembly)
                .CreateResolver();

            _commandBus = _resolver.Resolve<ICommandBus>();
            _eventStore = _resolver.Resolve<IEventStore>();
        }
开发者ID:joaomajesus,项目名称:EventFlow,代码行数:15,代码来源:BackwardCompatibilityTests.cs

示例7: AutoDiscover

        internal void AutoDiscover(IResolver resolver)
        {
            var types = _configurator.Assemblies.SelectMany(x => x.GetTypes()).Where(x => x.HasAttribute<MDataAttribute>()).Select(x => x);

            foreach (var assembly in _configurator.Assemblies)
            {
                RegisterAssembly(assembly);
            }

            foreach (var type in types)
            {
                RegisterDomainInterface(type, GetLogicClass(type));
                resolver.Resolve(type);
            }
        }
开发者ID:pietervp,项目名称:MData,代码行数:15,代码来源:TypeCreator.cs

示例8: GetUrl

        public string GetUrl(IResolver resolver)
        {
            string url = resolver.Resolve(this.url);
            this.result.ExecutedUrl = url;

            return url;
        }
开发者ID:Letractively,项目名称:webmvctest,代码行数:7,代码来源:Function.cs

示例9: GetPostData

        public NameValueCollection GetPostData(IResolver resolver)
        {
            NameValueCollection postData = new NameValueCollection();

            foreach (string key in this.postData.Keys)
            {
                postData[key] = resolver.Resolve(this.postData[key].ToString());
            }

            return postData;
        }
开发者ID:Letractively,项目名称:webmvctest,代码行数:11,代码来源:Function.cs

示例10: AssertResolveCanResolveIEnumerableType

		private void AssertResolveCanResolveIEnumerableType(IResolver resolver, string key = null)
		{
			// Test both generic and non - generic ? 

			var result = key == null ? resolver.Resolve<IEnumerable<IFoo>>() : resolver.Resolve<IEnumerable<IFoo>>(key);

			Assert.IsNotNull(result);
			Assert.IsInstanceOfType(result, typeof(IEnumerable<IFoo>));

			var collection = result.ToArray();

			CollectionAssert.AllItemsAreNotNull(collection);
			CollectionAssert.AllItemsAreUnique(collection);
			CollectionAssert.AllItemsAreInstancesOfType(collection, typeof(IFoo));
		}
开发者ID:Kingefosa,项目名称:Dynamo.IoC,代码行数:15,代码来源:ResolveTest.cs

示例11: RefreshContent

 void RefreshContent(IResolver container, IEnumerable<PostViewModel> posts)
 {
     var storage = container.Resolve<MarkdownSharpContentStorage>();
     foreach (var post in posts)
     {
         storage.Handle(post);
     }
 }
开发者ID:kijanawoodard,项目名称:Blog,代码行数:8,代码来源:PostGetController.cs

示例12: Install

        public void Install(DistributedConfiguration distributedConfiguration, string loggerConfiguration)
        {
            RegisterLogging(loggerConfiguration);

            if (distributedConfiguration == null)
            {
                // use nomad specific installer for that
                _windsorContainer.Install(
                    new NomadEventAggregatorInstaller(),
                    new NomadServiceLocatorInstaller(),
                    new ModuleLoaderInstaller()
                    );
            }
            else
            {
                // use nomad specific installer for that
                _windsorContainer.Install(
                    new NomadDistributedDeliverySubsystemsInstaller(distributedConfiguration),
                    new NomadDistributedEventAggregatorInstaller(),
                    new NomadServiceLocatorInstaller(),
                    new ModuleLoaderInstaller()
                    );

                // TODO: make registering resolver with container later
                var dea =
                    (DistributedEventAggregator)
                    _windsorContainer.Resolve<IEventAggregator>(NomadDistributedEventAggregatorInstaller.ON_SITE_NAME);

                _resolver = new ResolverFactory(distributedConfiguration);
                dea.RemoteDistributedEventAggregator = _resolver.Resolve();

                // run service
                RegisterServiceHostDEA(distributedConfiguration);
            }
        }
开发者ID:NomadPL,项目名称:Nomad,代码行数:35,代码来源:ContainerCreator.cs


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