/// <summary>
 /// Creates subscription to object changes
 /// </summary>
 /// <param name="workspaceId">Workspace identifier which is making a subscription</param>
 /// <param name="instanceId">Instance Id which changes are going to be notified</param>
 /// <param name="notifyChangesFromSameWorkspace">Defines if changes from same workspace should be notified</param>
 /// <param name="del">Delegate to be called</param>
 /// <returns>Subscription object</returns>
 public Subscription Create(Guid workspaceId, Guid instanceId, bool notifyChangesFromSameWorkspace, EventHandler<ObjectChangedEventArgs> del)
 {
     lock (subscriptions)
     {
         var id = Guid.NewGuid();
         var res = new SubscriptionElement(id, workspaceId, instanceId, Guid.Empty, notifyChangesFromSameWorkspace, del);
         subscriptions.Add(id, res);
         return new Subscription(id, workspaceId);
     }
 }
Exemple #2
0
 /// <summary>
 /// Creates subscription to object changes
 /// </summary>
 /// <param name="workspaceId">Workspace identifier which is making a subscription</param>
 /// <param name="instanceId">Instance Id which changes are going to be notified</param>
 /// <param name="notifyChangesFromSameWorkspace">Defines if changes from same workspace should be notified</param>
 /// <param name="del">Delegate to be called</param>
 /// <returns>Subscription object</returns>
 public Subscription Create(Guid workspaceId, Guid instanceId, bool notifyChangesFromSameWorkspace, EventHandler <ObjectChangedEventArgs> del)
 {
     lock (subscriptions)
     {
         var id  = Guid.NewGuid();
         var res = new SubscriptionElement(id, workspaceId, instanceId, Guid.Empty, notifyChangesFromSameWorkspace, del);
         subscriptions.Add(id, res);
         return(new Subscription(id, workspaceId));
     }
 }
Exemple #3
0
        /// <summary>
        /// Creates subscription to object changes for specific property
        /// </summary>
        /// <param name="workspaceId">Workspace identifier which is making a subscription</param>
        /// <param name="instanceId">Instance Id which changes are going to be notified</param>
        /// <param name="propertyName">Property name which changes are going to be notified</param>
        /// <param name="notifyChangesFromSameWorkspace">Defines if changes from same workspace should be notified</param>
        /// <param name="del">Delegate to be called</param>
        /// <returns>Subscription object</returns>
        public Subscription Create(Guid workspaceId, Guid instanceId, string propertyName, bool notifyChangesFromSameWorkspace, EventHandler <ObjectChangedEventArgs> del)
        {
            lock (subscriptions)
            {
                var id       = Guid.NewGuid();
                var typeId   = typesService.GetInstanceTypeId(instanceId);
                var memberId = typesService.GetTypeMemberId(typeId, propertyName);

                if (memberId.Equals(Guid.Empty))
                {
                    throw new ArgumentException("Property " + propertyName + " not found in type " + typesService.GetTypeFromId(typeId));
                }

                var res = new SubscriptionElement(id, workspaceId, instanceId, memberId, notifyChangesFromSameWorkspace, del);
                subscriptions.Add(id, res);
                return(new Subscription(id, workspaceId));
            }
        }
        /// <summary>
        /// Creates subscription to object changes for specific property
        /// </summary>
        /// <param name="workspaceId">Workspace identifier which is making a subscription</param>
        /// <param name="instanceId">Instance Id which changes are going to be notified</param>
        /// <param name="propertyName">Property name which changes are going to be notified</param>
        /// <param name="notifyChangesFromSameWorkspace">Defines if changes from same workspace should be notified</param>
        /// <param name="del">Delegate to be called</param>
        /// <returns>Subscription object</returns>
        public Subscription Create(Guid workspaceId, Guid instanceId, string propertyName, bool notifyChangesFromSameWorkspace, EventHandler<ObjectChangedEventArgs> del)
        {
            lock (subscriptions)
            {
                var id = Guid.NewGuid();
                var typeId = typesService.GetInstanceTypeId(instanceId);
                var memberId = typesService.GetTypeMemberId(typeId, propertyName);

                if (memberId.Equals(Guid.Empty))
                {
                    throw new ArgumentException("Property " + propertyName + " not found in type " + typesService.GetTypeFromId(typeId));
                }

                var res = new SubscriptionElement(id, workspaceId, instanceId, memberId, notifyChangesFromSameWorkspace, del);
                subscriptions.Add(id, res);
                return new Subscription(id, workspaceId);
            }
        }
        public async Task <ActionResult <SubscriptionElement> > PostSubscriptionElement([FromBody] SubscriptionElement SubscriptionElement)
        {
            await repository.CreateEntity(SubscriptionElement);

            return(SubscriptionElement);
        }
        public async Task <ActionResult <SubscriptionElement> > PutSubscriptionElement(int id, [FromBody] SubscriptionElement SubscriptionElement)
        {
            await repository.UpdateEntity(1, SubscriptionElement);

            return(SubscriptionElement);
        }