public static AssetPropertyGraph ConstructPropertyGraph(AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger) { var assetType = assetItem.Asset.GetType(); while (assetType != null) { var typeToTest = assetType.IsGenericType ? assetType.GetGenericTypeDefinition() : assetType; if (NodeGraphTypes.TryGetValue(typeToTest, out Type 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"); }
protected AssetCompositeHierarchyPropertyGraph([NotNull] AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger) : base(container, assetItem, logger) { HierarchyNode = RootNode[nameof(AssetCompositeHierarchy <TAssetPartDesign, TAssetPart> .Hierarchy)].Target; var rootPartsNode = HierarchyNode[nameof(AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> .RootParts)].Target; rootPartsNode.ItemChanged += RootPartsChanged; foreach (var childPartNode in Asset.Hierarchy.Parts.Values.SelectMany(x => RetrieveChildPartNodes(x.Part))) { RegisterChildPartNode(childPartNode); } var partsNode = HierarchyNode[nameof(AssetCompositeHierarchyData <IAssetPartDesign <IIdentifiable>, IIdentifiable> .Parts)].Target; partsNode.ItemChanged += PartsChanged; foreach (var part in Asset.Hierarchy.Parts.Values) { LinkToOwnerPart(Container.NodeContainer.GetNode(part.Part), part); } }
public AssetCompositePropertyGraph([NotNull] AssetPropertyGraphContainer container, [NotNull] AssetItem assetItem, ILogger logger) : base(container, assetItem, logger) { }