/// <summary>
        /// Initializes the topic client.
        /// </summary>
        /// <param name="description">
        /// The description.
        /// </param>
        private void InitializeClient(DescriptionBase description)
        {
            var connectionString = description.ConnectionString;
            var path             = description.Entity;

            this.Client = TopicClient.CreateFromConnectionString(connectionString, path);
        }
        /// <summary>
        /// Ensures the event hub exists asynchronously.
        /// </summary>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="AzureEventHubException">
        /// Occurs if there is an error creating the event hub.
        /// </exception>
        protected async Task EnsureEventHubExistsAsync(DescriptionBase description)
        {
            var cs  = description.ConnectionString;
            var hub = description.Entity;

            var manager = NamespaceManager.CreateFromConnectionString(cs);
            await manager.CreateEventHubIfNotExistsAsync(hub);
        }
        /// <summary>
        /// Ensures the event hub exists asynchronously.
        /// </summary>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="AzureEventHubException">
        /// Occurs if there is an error creating the event hub.
        /// </exception>
        protected async Task EnsureEventHubExistsAsync(DescriptionBase description)
        {
            var cs = description.ConnectionString;
            var hub = description.Entity;

            var manager = NamespaceManager.CreateFromConnectionString(cs);
            await manager.CreateEventHubIfNotExistsAsync(hub);
        }
        internal override bool Equals(DescriptionBase description)
        {
            var filterDescription = description as DelegateFilterDescription;

            if (filterDescription != null)
            {
                return(filterDescription.Key == this);
            }

            return(false);
        }
        internal override bool Equals(DescriptionBase description)
        {
            var propertyDescription = description as PropertyGroupDescription;

            if (propertyDescription == null)
            {
                return(false);
            }

            return(propertyDescription.PropertyName == this.propertyName);
        }
        internal override bool Equals(DescriptionBase description)
        {
            var delegateDescription = description as DelegateSortDescription;

            if (delegateDescription == null)
            {
                return(false);
            }

            return(delegateDescription.MemberAccess == this.sortDescription.MemberAccess);
        }
        internal override bool Equals(DescriptionBase description)
        {
            var delegateDescription = description as DelegateGroupDescription;

            if (delegateDescription == null)
            {
                return(false);
            }

            return(delegateDescription.MemberAccess == this.groupDescription.MemberAccess &&
                   delegateDescription.GroupFilter == this.groupDescription.GroupFilter);
        }
        internal override bool Equals(DescriptionBase description)
        {
            var aggregate = description as PropertyAggregateDescription;

            if (aggregate == null)
            {
                return(false);
            }

            return(aggregate.PropertyName == this.propertyName &&
                   aggregate.StringFormat == this.Format &&
                   AggregateFunctionEqualsKnownFunction(aggregate.AggregateFunction, this.Function));
        }
Exemple #9
0
        public void New()
        {
            StateBase       state       = TypeController.Instance.GetObjectOfType <StateBase>();
            DescriptionBase description = TypeController.Instance.GetObjectOfType <DescriptionBase>();

            description.Description = "Россия";
            description.Name        = "Russia";
            description.Name1       = "Россия";
            state.Description       = description;

            this.stateManager.SaveOrUpdate(state);
            Assert.IsTrue(state.Id > 0);
            Console.Write(state.Id);
        }
        internal override bool Equals(DescriptionBase description)
        {
            if (this.engineDescription == null)
            {
                return(false);
            }

            var delegateDescription = description as DelegateAggregateDescription;

            if (delegateDescription == null)
            {
                return(false);
            }

            return(delegateDescription.MemberAccess == this.engineDescription.MemberAccess &&
                   delegateDescription.AggregateFunction == this.engineDescription.AggregateFunction);
        }
        /// <summary>
        /// Ensures the topic exists.
        /// </summary>
        /// <param name="description">
        /// The publisher description
        /// </param>
        /// <returns>
        /// The <see cref="Task"/> representing the operation.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        /// Occurs when the description is null.
        /// </exception>
        /// <exception cref="AzureServiceBusException">
        /// Occurs when a service bus cannot be checked or created.
        /// </exception>
        protected async Task EnsureTopicExistsAsync(DescriptionBase description)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            var connectionString = description.ConnectionString;
            var path = description.Entity;

            var manager = NamespaceManager.CreateFromConnectionString(connectionString);

            if (!await manager.TopicExistsAsync(path))
            {
                await
                    manager.CreateTopicAsync(
                        new TopicDescription(path) { EnablePartitioning = true, EnableBatchedOperations = true });
            }
        }
        /// <summary>
        /// Ensures the topic exists.
        /// </summary>
        /// <param name="description">
        /// The publisher description
        /// </param>
        /// <returns>
        /// The <see cref="Task"/> representing the operation.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        /// Occurs when the description is null.
        /// </exception>
        /// <exception cref="AzureServiceBusException">
        /// Occurs when a service bus cannot be checked or created.
        /// </exception>
        protected async Task EnsureTopicExistsAsync(DescriptionBase description)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            var connectionString = description.ConnectionString;
            var path             = description.Entity;

            var manager = NamespaceManager.CreateFromConnectionString(connectionString);

            if (!await manager.TopicExistsAsync(path))
            {
                await
                manager.CreateTopicAsync(
                    new TopicDescription(path) { EnablePartitioning = true, EnableBatchedOperations = true });
            }
        }
Exemple #13
0
 public void OutputDescription <T>(DescriptionBase <T> description) where T : DescriptionBase <T>
 {
     description.Lines.ForEach(l => Output.WriteLine(l));
 }
 /// <summary>
 /// Initializes the topic client.
 /// </summary>
 /// <param name="description">
 /// The description.
 /// </param>
 private void InitializeClient(DescriptionBase description)
 {
     var connectionString = description.ConnectionString;
     var path = description.Entity;
     this.Client = TopicClient.CreateFromConnectionString(connectionString, path);
 }
Exemple #15
0
 internal abstract bool Equals(DescriptionBase description);