コード例 #1
0
        public void MergeObjects(Guid nodeId, Node <Guid, object, EdgeData> originalNode, Node <Guid, object, EdgeData> changedNode, Node <Guid, object, EdgeData> node, MergeRecursiveDelegate mergeRecursive, InsertRecursiveDelegate insertRecursive, RecursiveResolutionParameters parameters)
        {
            Guid typeId = typesService.GetInstanceTypeId(originalNode);

            if (!objectAttributeProvider.IsConcurrent(typeId))
            {
                var instanceType = typesService.GetTypeFromId(typesService.GetInstanceTypeId(nodeId));
                throw new ConcurrentModificationException("Concurrent modification not allowed for entity type:" + instanceType.ToString());
            }

            if (objectAttributeProvider.IsStaticConcurrency(typeId))
            {
                MergeObjectsStatic(nodeId, typeId, originalNode, changedNode, node, mergeRecursive, insertRecursive, parameters);
            }
            else
            {
                throw new NotImplementedException("Dynamic concurrency not implemented");
            }
        }
コード例 #2
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));
            }
        }
コード例 #3
0
        private static void LogObject(Guid nodeId, Node <Guid, object, EdgeData> node, INodeProvider <Guid, object, EdgeData> nodes, INodeProvider <Guid, object, EdgeData> changes, int tabLevel, Hashtable visited, TypesService typesService)
        {
            var typeId   = typesService.GetInstanceTypeId(node);
            var typeName = typesService.GetTypeFromId(typeId).Name;

            Debug.WriteLine(LogTabs(tabLevel) + nodeId + "(" + typeName + ")");
            Debug.WriteLine(LogTabs(tabLevel) + "Previous=" + node.Previous);

            foreach (var value in node.Values)
            {
                Debug.WriteLine(LogTabs(tabLevel) + typesService.GetMemberName(typeId, value.Key) + "=" + value.Value);
            }

            foreach (var edge in node.Edges)
            {
                if (edge.Value.Data.Semantic == EdgeType.Property)
                {
                    Debug.WriteLine(LogTabs(tabLevel) + typesService.GetMemberName(typeId, (Guid)edge.Value.Data.Data) + "=");
                    LogNodesRecursive(edge.Value.ToNodeId, nodes, changes, tabLevel + 1, visited, typesService);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Sets reference of object as immutable
        /// </summary>
        /// <param name="instance">Object which holds the reference</param>
        /// <param name="propertyName">Property name of the reference</param>
        public void SetImmutable(object instance, string propertyName)
        {
            var instanceId = Utils.GetItemId(instance);

            objectInstancesService.SetImmutable(instanceId, typesService.GetTypeMemberId(typesService.GetInstanceTypeId(instanceId), propertyName));
        }