public static IGraphModel FromTypes(Type[] vertexTypes, Type[] edgeTypes) { var verticesModel = GraphElementModel.FromTypes(vertexTypes); var edgesModel = GraphElementModel.FromTypes(edgeTypes); return(new GraphModelImpl( verticesModel, edgesModel, GraphElementPropertyModel.FromGraphElementModels(verticesModel, edgesModel))); }
public AssemblyGraphModel(Type vertexBaseType, Type edgeBaseType, IEnumerable <Assembly> assemblies, ILogger logger) { if (vertexBaseType.IsAssignableFrom(edgeBaseType)) { throw new ArgumentException($"{vertexBaseType} may not be in the inheritance hierarchy of {edgeBaseType}."); } if (edgeBaseType.IsAssignableFrom(vertexBaseType)) { throw new ArgumentException($"{edgeBaseType} may not be in the inheritance hierarchy of {vertexBaseType}."); } var assemblyArray = assemblies .Append(vertexBaseType.Assembly) .Append(edgeBaseType.Assembly) .Distinct() .ToArray(); VerticesModel = new AssemblyGraphElementModel(vertexBaseType, assemblyArray, logger); EdgesModel = new AssemblyGraphElementModel(edgeBaseType, assemblyArray, logger); PropertiesModel = GraphElementPropertyModel.FromGraphElementModels(VerticesModel, EdgesModel); }
public static IGraphModel FromBaseTypes(Type vertexBaseType, Type edgeBaseType, Func <IAssemblyLookupBuilder, IAssemblyLookupSet> assemblyLookupTransformation, ILogger?logger = null) { if (vertexBaseType.IsAssignableFrom(edgeBaseType)) { throw new ArgumentException($"{vertexBaseType} may not be in the inheritance hierarchy of {edgeBaseType}."); } if (edgeBaseType.IsAssignableFrom(vertexBaseType)) { throw new ArgumentException($"{edgeBaseType} may not be in the inheritance hierarchy of {vertexBaseType}."); } var assemblies = assemblyLookupTransformation(new AssemblyLookupSet(new [] { vertexBaseType, edgeBaseType }, ImmutableList <Assembly> .Empty)) .Assemblies; var verticesModel = GraphElementModel.FromBaseType(vertexBaseType, assemblies, logger); var edgesModel = GraphElementModel.FromBaseType(edgeBaseType, assemblies, logger); return(new GraphModelImpl( verticesModel, edgesModel, GraphElementPropertyModel.FromGraphElementModels(verticesModel, edgesModel))); }