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


C# ICollection.OfType方法代码示例

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


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

示例1: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.Anpr, _request);

            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                _dataProvider = _request.First().Package.DataProviders.Single(w => w.Name == DataProviderName.Anpr);
                _logCommand = LogCommandTypes.ForDataProvider(_command, DataProviderCommandSource.Anpr, _dataProvider);

                _logCommand.LogBegin(new {_dataProvider});

                //TODO: System.Data issue on the build server causes an error
                //var consumer = new ConsumeSource(new HandleAnprSourceCall(),
                //    new CallAnprExternalSource(_request,
                //        new RepositoryFactory(ConnectionFactory.ForLsCorporateAutoDatabase(),
                //            CacheConnectionFactory.LocalClient(), ConfigurationManager.ConnectionStrings["lace/source/database/anpr/certificates/configuration"].ConnectionString)));

                //consumer.ConsumeExternalSource(response, laceEvent);

                _logCommand.LogEnd(new {response});

                if (!response.OfType<IProvideDataFromAnpr>().Any() || response.OfType<IProvideDataFromAnpr>().First() == null)
                    CallFallbackSource(response, _command);
            }
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:29,代码来源:AnprDataProvider.cs

示例2: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.Audatex, _request);

            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                _dataProvider = _request.First().Package.DataProviders.Single(w => w.Name == DataProviderName.Audatex);
                _logCommand = LogCommandTypes.ForDataProvider(_command, DataProviderCommandSource.Ivid, _dataProvider);

                _logCommand.LogBegin(new { _request, IvidResponse = response.OfType<IProvideDataFromIvid>().First() });

                var consumer = new ConsumeSource(new HandleAudatexSourceCall(), new CallAudatexDataProvider(_dataProvider,_logCommand));
                consumer.ConsumeDataProvider(response);

                _logCommand.LogEnd(new { response });

                if (!response.OfType<IProvideDataFromAudatex>().Any() || response.OfType<IProvideDataFromAudatex>().First() == null)
                    CallFallbackSource(response, _command);
            }

            CallNextSource(response, _command);
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:26,代码来源:AudatexDataProvider.cs

示例3: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.Jis, _request);

            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                _dataProvider = _request.First().Package.DataProviders.Single(w => w.Name == DataProviderName.Jis);
                _logCommand = LogCommandTypes.ForDataProvider(_command, DataProviderCommandSource.Jis, _dataProvider);

                //var consumer = new ConsumeSource(new HandleJisSourceCall(),
                //    new CallJisDataProvider(_dataProvider,
                //        new RepositoryFactory(ConnectionFactoryManager.ForLsCorporateAutoDatabase(),
                //            ConfigurationManager.ConnectionStrings["lace/source/database/jis/certificates/configuration"
                //                ].ConnectionString),_logCommand));
                //consumer.ConsumeDataProvider(response);

                if (!response.OfType<IProvideDataFromJis>().Any() || response.OfType<IProvideDataFromJis>().First() == null)
                    CallFallbackSource(response, _command);
            }

            CallNextSource(response, _command);
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:26,代码来源:JisDataProvider.cs

示例4: then_tehcnical_no_results_should_be_thrown

        public void then_tehcnical_no_results_should_be_thrown()
        {
            _request = new[] { new NoRecordCarIdLightstoneOnlyRequest() };
            _response = new Collection<IPointToLaceProvider>();

            _consumer = new LightstoneAutoDataProvider(_request, null, null, _command);
            _consumer.CallSource(_response);


            _response.OfType<IProvideDataFromLightstoneAuto>().First().ShouldNotBeNull();
            _response.OfType<IProvideDataFromLightstoneAuto>().First().Handled.ShouldBeTrue();
            _response.OfType<IProvideDataFromLightstoneAuto>().First().ResponseState.ShouldEqual(DataProviderResponseState.NoRecords);
            _response.OfType<IProvideDataFromLightstoneAuto>().First().ResponseStateMessage.ShouldNotBeEmpty();
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:14,代码来源:when_executing_request_with_errors_for_lightstone.cs

示例5: then_tehcnical_error_should_be_thrown

        public void then_tehcnical_error_should_be_thrown()
        {
            _request = new[] { new LicensePlateNumberLightstoneOnlyRequest() };
            _response = new Collection<IPointToLaceProvider>()
            {
                IvidResponse.WithState(DataProviderResponseState.TechnicalError)
            };

            _consumer = new LightstoneAutoDataProvider(_request, null, null, _command);
            _consumer.CallSource(_response);

            _response.HasAllRecords().ShouldBeFalse();
            _response.OfType<IProvideDataFromLightstoneAuto>().First().ShouldNotBeNull();
            _response.OfType<IProvideDataFromLightstoneAuto>().First().Handled.ShouldBeTrue();
            _response.OfType<IProvideDataFromLightstoneAuto>().First().ResponseState.ShouldEqual(DataProviderResponseState.NoRecords);
            _response.OfType<IProvideDataFromLightstoneAuto>().First().ResponseStateMessage.ShouldNotBeEmpty();
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:17,代码来源:when_executing_request_with_errors_for_lightstone.cs

示例6: RegisterStandardViewFolders

        public void RegisterStandardViewFolders(ICollection<IViewEngine> viewEngines, Assembly assembly, string areaName)
        {
            var viewFolder = new EmbeddedViewFolder(assembly, assembly.GetName().Name + ".Views");
            var sparkViewFactory = viewEngines.OfType<SparkViewFactory>().First();

            sparkViewFactory.ViewFolder = sparkViewFactory.ViewFolder
                .Append(new SubViewFolder(viewFolder, areaName))
                .Append(new SubViewFolder(viewFolder, "Shared\\" + areaName));
        }
开发者ID:Eilon,项目名称:spark,代码行数:9,代码来源:WebPackageBase.cs

示例7: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.LSAutoDecryptDriverLic_I_WS, _request);
            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                var consumer = new ConsumeSource(new HandleSignioSourceCall(), new FakeCallingSignioDataProvider());
                consumer.ConsumeDataProvider(response);

                if (!response.OfType<IProvideDataFromSignioDriversLicenseDecryption>().Any() || response.OfType<IProvideDataFromSignioDriversLicenseDecryption>().First() == null)
                    CallFallbackSource(response, _command);
            }

            CallNextSource(response, _command);
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:18,代码来源:SignioDataProvider.cs

示例8: Register

        private static void Register(DataGrid dataGrid, ICollection configurations)
        {
            Contract.Requires(dataGrid != null);
            if (configurations == null)
                return;

            dataGrid.Columns.AddRange(configurations.OfType<SolutionConfiguration>().Select(CreateColumn));

            ((INotifyCollectionChanged)configurations).CollectionChanged += (sender, e) => SolutionConfigurations_CollectionChanged(dataGrid, e);
        }
开发者ID:trzombie,项目名称:ProjectConfigurationManager,代码行数:10,代码来源:BuildConfigurationColumnsManager.cs

示例9: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.PCubedFica_E_WS, _request);
            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                var consumer = new ConsumeSource(new HandlePCubedFicaSourceCall(), new FakeCallingPCubedDataProvider());
                consumer.ConsumeDataProvider(response);

                if (!response.OfType<IProvideDataFromPCubedFicaVerfication>().Any() ||
                    response.OfType<IProvideDataFromPCubedFicaVerfication>().First() == null)
                    CallFallbackSource(response, _command);
            }

            CallNextSource(response, _command);
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:19,代码来源:FakePCubedDataProvider.cs

示例10: CombineTermsForSameField

        /// <summary>
        /// Takes a collection of <see cref="ICriteria" /> and if they are all 
        /// <see cref="ITermsCriteria" /> for the same field replaces them with a single
        /// <see cref="ITermsCriteria" /> containing all terms for that field.
        /// </summary>
        /// <param name="criteria">collection of <see cref="ICriteria" /> that might be combined.</param>
        /// <returns><see cref="ITermsCriteria" /> containing all terms for that field or null if they can not be combined.</returns>
        static ICriteria CombineTermsForSameField(ICollection<ICriteria> criteria)
        {
            var termCriteria = criteria.OfType<ITermsCriteria>().ToArray();
            var areAllSameTerm = termCriteria.Length == criteria.Count
                                 && termCriteria.Select(f => f.Field).Distinct().Count() == 1
                                 && termCriteria.All(f => f.IsOrCriteria);

            return areAllSameTerm
                ? TermsCriteria.Build(termCriteria[0].Field, termCriteria[0].Member, termCriteria.SelectMany(f => f.Values).Distinct())
                : null;
        }
开发者ID:jarlrasm,项目名称:ElasticLINQ,代码行数:18,代码来源:OrCriteria.cs

示例11: PostFlush

        public override void PostFlush(ICollection entities)
        {
            IEnumerable<MongoNode> nodes = entities.OfType<MongoNode>();

            if (!nodes.Any())
                return;

            var repository = new NodeLinkRepository();
            Task[] tasks = nodes.Select(x => repository.SaveLinks(x.Id, x.Links)).ToArray();
            Task.WaitAll(tasks);
        }
开发者ID:bennotti,项目名称:SqlWithMongo,代码行数:11,代码来源:Interceptor.cs

示例12: CreateDestinationNode

        /// <summary>
        /// Creates the destination node.
        /// </summary>
        /// <param name="objectsCollection">The objects collection.</param>
        /// <param name="destinationNodeName">Name of the destination node.</param>
        /// <returns>DestinationNode.</returns>
        public DestinationNode CreateDestinationNode(ICollection<IExpressionObjectBase> objectsCollection, string destinationNodeName)
        {
            RestoreConnections(objectsCollection);
            Validate(objectsCollection);

            _values = new Dictionary<string, object>();

            var destination = objectsCollection.OfType<DestinationFieldList>().FirstOrDefault(t => t.UniqueName == destinationNodeName);

            return destination != null ? ToExpressionNode(destination) : null;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:17,代码来源:ExpressionNodeFactory.cs

示例13: Register

        private static void Register(DataGrid dataGrid, ICollection propertieGroups)
        {
            Contract.Requires(dataGrid != null);

            if (propertieGroups == null)
                return;

            dataGrid.Columns.AddRange(propertieGroups.OfType<CollectionViewGroup>().SelectMany(group => group.Items.Cast<ProjectPropertyName>()).Select(CreateColumn));

            ((INotifyCollectionChanged)propertieGroups).CollectionChanged += (sender, e) => ProjectProperties_CollectionChanged(dataGrid, e);
        }
开发者ID:trzombie,项目名称:ProjectConfigurationManager,代码行数:11,代码来源:ProperitesColumnsMananger.cs

示例14: CallSource

        public void CallSource(ICollection<IPointToLaceProvider> response)
        {
            var spec = new CanHandlePackageSpecification(DataProviderName.IVIDTitle_E_WS, _request);

            if (!spec.IsSatisfied)
            {
                NotHandledResponse(response);
            }
            else
            {
                var consumer = new ConsumeSource(new FakeHandleIvidTitleHolderServiceCall(),
                    new FakeCallingIvidTitleHolderExternalWebService());
                consumer.ConsumeDataProvider(response);

                if (!response.OfType<IProvideDataFromIvidTitleHolder>().Any() || response.OfType<IProvideDataFromIvid>().First() == null)
                    CallFallbackSource(response, _command);
            }

            CallNextSource(response, _command);
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:20,代码来源:IvidTitleHolderDataProvider.cs

示例15: SeriesEditControl

        public SeriesEditControl(ICollection series, List<String> visible)
        {
            InitializeComponent();
            List<string> strs = series.OfType<String>().ToList();
            checkedListBox1.Items.AddRange(strs.ToArray());

            foreach (string s in visible)
            {
                checkedListBox1.SetItemChecked(strs.IndexOf(s), true);
            }
        }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:11,代码来源:SeriesEditControl.cs


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