Ejemplo n.º 1
0
        public AssetPropertyGraph(AssetPropertyGraphContainer container, AssetItem assetItem, ILogger logger)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }
            if (assetItem == null)
            {
                throw new ArgumentNullException(nameof(assetItem));
            }
            Container = container;
            AssetCollectionItemIdHelper.GenerateMissingItemIds(assetItem.Asset);
            CollectionItemIdsAnalysis.FixupItemIds(assetItem, logger);
            Asset    = assetItem.Asset;
            RootNode = (AssetObjectNode)Container.NodeContainer.GetOrCreateNode(assetItem.Asset);
            ApplyOverrides(RootNode, assetItem.Overrides);
            nodeListener           = new GraphNodeChangeListener(RootNode, ShouldListenToTargetNode);
            nodeListener.Changing += AssetContentChanging;
            nodeListener.Changed  += AssetContentChanged;

            baseLinker = new AssetToBaseNodeLinker(this)
            {
                LinkAction = LinkBaseNode
            };
        }
        public static AssetPropertyGraph ConstructPropertyGraph(AssetPropertyGraphContainer container, AssetItem assetItem, ILogger logger)
        {
            var assetType = assetItem.Asset.GetType();

            while (assetType != null)
            {
                Type propertyGraphType;
                var  typeToTest = assetType.IsGenericType ? assetType.GetGenericTypeDefinition() : assetType;
                if (NodeGraphTypes.TryGetValue(typeToTest, out propertyGraphType))
                {
                    return((AssetPropertyGraph)Activator.CreateInstance(propertyGraphType, container, assetItem, logger));
                }
                assetType = assetType.BaseType;
            }
            throw new InvalidOperationException("No AssetPropertyGraph type matching the given asset type has been found");
        }
 public AssetCompositeHierarchyPropertyGraph(AssetPropertyGraphContainer container, AssetItem assetItem, ILogger logger)
     : base(container, assetItem, logger)
 {
 }
Ejemplo n.º 4
0
 protected AssetCompositeHierarchyPropertyGraph(AssetPropertyGraphContainer container, AssetItem assetItem, ILogger logger)
     : base(container, assetItem, logger)
 {
     HierarchyNode = RootNode[nameof(AssetCompositeHierarchy <TAssetPartDesign, TAssetPart> .Hierarchy)].Target;
 }