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


C# SqlFilter类代码示例

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


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

示例1: CreateSubscription

        public void CreateSubscription(ServiceBusEnpointData value) {
            //TODO determine how we can change the filters for an existing registered item

            logger.Log(LogLevel.Info, "CreateSubscription {0} Declared {1} MessageTytpe {2}, IsReusable {3}", value.SubscriptionName, value.DeclaredType.ToString(), value.MessageType.ToString(), value.IsReusable);

            SubscriptionDescription desc = null;

            var data = value.MessageType.FullName;

            if (!namespaceManager.SubscriptionExists(topic.Path, value.SubscriptionName)) {
                logger.Log(LogLevel.Info, "CreateSubscription Creating {0}", value.SubscriptionName);

                var filter = new SqlFilter(string.Format(TYPE_HEADER_NAME + " = '{0}'", value.MessageType.FullName.Replace('.', '_')));
                Helpers.Execute(() => {
                    desc = namespaceManager.CreateSubscription(topic.Path, value.SubscriptionName, filter);
                });
            }
            else {
                logger.Log(LogLevel.Info, "CreateSubscription Exists {0}", value.SubscriptionName);
                desc = namespaceManager.GetSubscription(topic.Path, value.SubscriptionName);
            }

            SubscriptionClient subscriptionClient = factory.CreateSubscriptionClient(topic.Path, value.SubscriptionName, ReceiveMode.PeekLock);

            var state = new AzureBusReceiverState() {
                Client = subscriptionClient,
                EndPointData = value,
                Subscription = desc
            };
            mappings.Add(state);

            Task t = new Task(ProcessMessagesForSubscription, state);
            t.Start();
        }
开发者ID:onpoint,项目名称:ProjectExtensions.Azure.ServiceBus,代码行数:34,代码来源:AzureBusReceiver.cs

示例2: CreateAndGetSubscriptionInternal

        private SubscriptionClient CreateAndGetSubscriptionInternal(string subscriptionName, ISpecification filterSpecification)
        {
            var filter = new SqlFilter(filterSpecification.Result());
            EnsureSubscriptionNameIsValid(subscriptionName);

            log.Info($"Checking subscription for path {subscriptionName} exists");

            if (!this.namespaceManager.SubscriptionExists(this.topic, subscriptionName))
            {
                log.Info("Creating subscription as it does not currently exist");

                var subscriptionDescription = new SubscriptionDescription(this.topic, subscriptionName)
                {
                    LockDuration = TimeSpan.FromMinutes(5)
                };

                this.namespaceManager.CreateSubscription(subscriptionDescription, filter);

                log.Info("Subscription created");
            }

            log.Info("Creating subscription client");

            var client = SubscriptionClient.CreateFromConnectionString(
                connectionString, this.topic, subscriptionName);

            log.Info("Subscription client created");

            return client;
        }
开发者ID:DannyRyman,项目名称:Azure.ServiceBus.Facade,代码行数:30,代码来源:SubscriptionClientFactory.cs

示例3: Main

        static void Main(string[] args)
        {
            string topicName = "sb-salesorder-topic";
            string sbconnection = "Endpoint=sb://sb-twocents-ns.servicebus.windows.net/;SharedAccessKeyName=Admin;SharedAccessKey=mueFV8NQkt5MmSIMzbbXvBw4EAtXLntue/gLP7OfSEE=";
            var ns = NamespaceManager.CreateFromConnectionString(sbconnection);
            SqlFilter filter = new SqlFilter("Priority=1");
            ns.CreateSubscription(topicName, "salesorder-sub-priority", filter);

        }
开发者ID:PaulBaars,项目名称:TwoCents,代码行数:9,代码来源:Program.cs

示例4: PreExecute

        public void PreExecute(SqlFilter filter)
        {
            if (filter == null)
                throw new ArgumentNullException("filter");

            // get...
            UserItem user = ServiceAuthenticator.Current.GetUser();
            if (user == null)
                throw new InvalidOperationException("'user' is null.");

            // mangle the query...
            filter.Constraints.Add("userid", user.UserId);
        }
开发者ID:Val9,项目名称:AmxMobile.Services-1.1,代码行数:13,代码来源:BookmarkFilterCallback.cs

示例5: CancelSubscription

        /// <summary>
        /// Cancel a subscription
        /// </summary>
        /// <param name="value">The data used to cancel the subscription</param>
        public void CancelSubscription(ServiceBusEnpointData value)
        {
            Guard.ArgumentNotNull(value, "value");
            var subscription = mappings.FirstOrDefault(item => item.Data.EndPointData.SubscriptionName.Equals(value.SubscriptionName, StringComparison.OrdinalIgnoreCase));

            if (subscription == null)
            {
                return;
            }

            subscription.Data.Cancel();

            Task t = Task.Factory.StartNew(() =>
            {
                //HACK find better way to wait for a cancel request so we are not blocking.
                for (int i = 0; i < 100; i++)
                {
                    if (!subscription.Data.Cancelled)
                    {
                        Thread.Sleep(1000);
                    }
                    else
                    {
                        break;
                    }
                }

                if (configurationFactory.NamespaceManager.SubscriptionExists(topic.Path, value.SubscriptionName))
                {
                    var filter = new SqlFilter(string.Format(TYPE_HEADER_NAME + " = '{0}'", value.MessageType.FullName.Replace('.', '_')));
                    retryPolicy.ExecuteAction(() => configurationFactory.NamespaceManager.DeleteSubscription(topic.Path, value.SubscriptionName));
                }
            });

            try
            {
                Task.WaitAny(t);
            }
            catch (Exception ex)
            {
                if (ex is AggregateException)
                {
                    //do nothing
                }
                else
                {
                    throw;
                }
            }
        }
开发者ID:apibridge,项目名称:ApiBridge,代码行数:54,代码来源:BusReceiver.cs

示例6: Main

        static void Main(string[] args)
        {
            string connectionStr = ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"];
            NamespaceManager nsm = NamespaceManager.CreateFromConnectionString(connectionStr);
            string topicName = "yolitopic";
            TopicDescription topic = null;
            if (!nsm.TopicExists(topicName))
            {
                nsm.CreateTopic(new TopicDescription(topicName) { 
                    EnablePartitioning = false
                });
            }

            topic = nsm.GetTopic(topicName);

            if (topic.SubscriptionCount == 0)
            {
                SqlFilter filter1 = new SqlFilter("(index % 2) = 0");
                nsm.CreateSubscription(topic.Path, "YoliSubscription1", filter1);
                SqlFilter filter2 = new SqlFilter("(index % 2) > 0");
                nsm.CreateSubscription(topic.Path, "YoliSubscription2", filter2);
            }
            //
            //sadfsdf

            foreach(var s in nsm.GetSubscriptions(topicName))
            {
                Console.WriteLine(s.Name);
                foreach(var r in nsm.GetRules(topic.Path,s.Name))
                {
                    Console.WriteLine("{0}-{1}", r.Name, r.Filter.ToString());
                }
            }

            Console.WriteLine("Sending message to topic");

            TopicClient topicClient = TopicClient.CreateFromConnectionString(connectionStr, topicName);
            for (int i = 0; i < 5000; i++)
            {
                BrokeredMessage message = new BrokeredMessage();
                message.Properties["index"] = i;
                message.Properties["value"] = (i * 10 + 5) % 11;
                topicClient.Send(message);
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
开发者ID:woodvase,项目名称:LearnServiceBusGit,代码行数:48,代码来源:Program.cs

示例7: GetOrCreateSubscription

        public static SubscriptionDescription GetOrCreateSubscription(this NamespaceManager namespaceManager, TopicDescription topicDescription,
                                                                      string name)
        {
            if (!namespaceManager.SubscriptionExists(topicDescription.Path, name))
            {
                try
                {
                    var filter = new SqlFilter(string.Format("LogicalDestinationQueue = '{0}'", name));
                    var subscription = namespaceManager.CreateSubscription(topicDescription.Path, name, filter);
                    return subscription;
                }
                catch (MessagingEntityAlreadyExistsException)
                {
                }
            }

            return namespaceManager.GetSubscription(topicDescription.Path, name);
        }
开发者ID:plillevold,项目名称:Rebus,代码行数:18,代码来源:TestAzureServiceBusMessageQueueFactory.cs

示例8: EnsureTopic

        private async Task EnsureTopic()
        {
            var namespaceManager = NamespaceManager.CreateFromConnectionString(_globalSettings.ServiceBusConnectionString);

            if (await namespaceManager.TopicExistsAsync(_globalSettings.DiscoTopicName) == false)
            {
                await namespaceManager.CreateTopicAsync(_globalSettings.DiscoTopicName);
            }
            if (await namespaceManager.SubscriptionExistsAsync(_globalSettings.DiscoTopicName, "Gadgets") == false)
            {
                var discoFilter = new SqlFilter("Disco = true");
                await namespaceManager.CreateSubscriptionAsync(_globalSettings.DiscoTopicName, "Gadgets", discoFilter);
            }
            if (await namespaceManager.SubscriptionExistsAsync(_globalSettings.DiscoTopicName, "Notifications") == false)
            {
                await namespaceManager.CreateSubscriptionAsync(_globalSettings.DiscoTopicName, "Notifications");
            }
        }
开发者ID:mikkelhm,项目名称:UnicornWeb,代码行数:18,代码来源:TopicService.cs

示例9: MakeSubscription

        public void MakeSubscription()
        {
            //https://msdn.microsoft.com/en-us/library/azure/hh367516.aspx
            //http://azure.microsoft.com/EN-US/documentation/articles/service-bus-dotnet-how-to-use-topics-subscriptions/

            string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");

            var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            if (!namespaceManager.SubscriptionExists("WebsiteMessages", "Problem"))
            {
                SqlFilter filter = new SqlFilter("FormType = 'Problem'");
                namespaceManager.CreateSubscription("WebsiteMessages", "Problem", filter);
            }

            if (!namespaceManager.SubscriptionExists("WebsiteMessages", "Question"))
            {
                SqlFilter filter = new SqlFilter("FormType = 'Question'");
                namespaceManager.CreateSubscription("WebsiteMessages", "Question", filter);
            }
        }
开发者ID:RodricDegroote,项目名称:Server-Side-Advanced,代码行数:21,代码来源:ServiceBusService.cs

示例10: Main

        private static void Main(string[] args)
        {
            string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");

            var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            // Create topic
            if (!namespaceManager.TopicExists(_topicName))
            {
                namespaceManager.CreateTopic(_topicName);
            }

            // Create subscriptions
            if (!namespaceManager.SubscriptionExists(_topicName, "Bookings"))
            {
                SqlFilter filter = new SqlFilter("EventType = 'Booking'");
                namespaceManager.CreateSubscription(_topicName, "Bookings", filter);
            }
            if (!namespaceManager.SubscriptionExists(_topicName, "Notifications"))
            {
                SqlFilter filter = new SqlFilter("EventType = 'Notification'");
                namespaceManager.CreateSubscription(_topicName, "Notifications", filter);
            }

            // Push messages to topics
            TopicClient client = TopicClient.CreateFromConnectionString(connectionString, _topicName);

            int count = 1;
            while (true)
            {
                Task.Run(() => SendMessage(client, "Booking", count));
                Task.Run(() => SendMessage(client, "Notification", count));
                Thread.Sleep(2000);

                count++;
                if (count > 20) break;
            }
        }
开发者ID:danielgauci,项目名称:toll,代码行数:38,代码来源:Program.cs

示例11: Create

        public SubscriptionClient Create(Type eventType, string topicPath, string subscriptionname)
        {
            if (NamespaceClient.TopicExists(topicPath))
            {
                try
                {
                    if (!NamespaceClient.SubscriptionExists(topicPath, subscriptionname))
                    {
                        var description = new SubscriptionDescription(topicPath, subscriptionname)
                            {
                                LockDuration = LockDuration,
                                RequiresSession = RequiresSession,
                                DefaultMessageTimeToLive = DefaultMessageTimeToLive,
                                EnableDeadLetteringOnMessageExpiration = EnableDeadLetteringOnMessageExpiration,
                                MaxDeliveryCount = MaxDeliveryCount,
                                EnableBatchedOperations = EnableBatchedOperations,
                                EnableDeadLetteringOnFilterEvaluationExceptions =
                                    EnableDeadLetteringOnFilterEvaluationExceptions
                            };

                        var filter = string.Format( "[{0}] LIKE '{1}%' OR [{0}] LIKE '%{1}%' OR [{0}] LIKE '%{1}' OR [{0}] = '{1}'", Headers.EnclosedMessageTypes, eventType.AssemblyQualifiedName);
                        var typefilter = new SqlFilter(filter);

                        NamespaceClient.CreateSubscription(description, typefilter);

                    }
                }
                catch (MessagingEntityAlreadyExistsException)
                {
                    // the queue already exists or another node beat us to it, which is ok
                }

                return Factory.CreateSubscriptionClient(topicPath, subscriptionname, ReceiveMode.PeekLock);
               
            }
            return null;
        }
开发者ID:modulexcite,项目名称:NServiceBus.WindowsServiceBus,代码行数:37,代码来源:WindowsServicebusSubscriptionClientCreator.cs

示例12: GetRecords

        /// <summary>
        /// This is a shared function that can be used to get an array of UsersRecord records using a where and order by clause clause with pagination.
        /// </summary>
        public static UsersRecord[] GetRecords(BaseFilter join, string where, OrderBy orderBy, int pageIndex, int pageSize)
        {
            SqlFilter whereFilter = null;
            if (where != null && where.Trim() != "")
            {
               whereFilter = new SqlFilter(where);
            }

            ArrayList recList = UsersTable.Instance.GetRecordList(join, whereFilter, null, orderBy, pageIndex, pageSize);

            return (UsersRecord[])recList.ToArray(Type.GetType("FPCEstimate.Business.UsersRecord"));
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:15,代码来源:BaseUsersTable.cs

示例13: GetRecords

        /// <summary>
        /// This is a shared function that can be used to get an array of EstimateRecord records using a where and order by clause clause with pagination.
        /// </summary>
        public static EstimateRecord[] GetRecords(string where, OrderBy orderBy, int pageIndex, int pageSize)
        {
            SqlFilter whereFilter = null;
            if (where != null && where.Trim() != "")
            {
               whereFilter = new SqlFilter(where);
            }
            BaseClasses.Data.BaseFilter join = null;
            ArrayList recList = EstimateTable.Instance.GetRecordList(join, whereFilter, null, orderBy, pageIndex, pageSize);

            return (EstimateRecord[])recList.ToArray(Type.GetType("FPCEstimate.Business.EstimateRecord"));
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:15,代码来源:BaseEstimateTable.cs

示例14: GetRecord

        /// <summary>
        /// This is a shared function that can be used to get a UsersRecord record using a where and order by clause.
        /// </summary>
        public static UsersRecord GetRecord(BaseFilter join, string where, OrderBy orderBy)
        {
            SqlFilter whereFilter = null;
            if (where != null && where.Trim() != "")
            {
               whereFilter = new SqlFilter(where);
            }

            ArrayList recList = UsersTable.Instance.GetRecordList(join, whereFilter, null, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE);

            UsersRecord rec = null;
            if (recList.Count > 0)
            {
            rec = (UsersRecord)recList[0];
            }

            return rec;
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:21,代码来源:BaseUsersTable.cs

示例15: GetRecordCount

        /// <summary>
        /// This is a shared function that can be used to get total number of records that will be returned using the where clause.
        /// </summary>
        public static int GetRecordCount(BaseFilter join, string where)
        {
            SqlFilter whereFilter = null;
            if (where != null && where.Trim() != "")
            {
               whereFilter = new SqlFilter(where);
            }

            return (int)UsersTable.Instance.GetRecordListCount(join, whereFilter, null, null);
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:13,代码来源:BaseUsersTable.cs


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