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 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))); }