예제 #1
0
        public static bool GenerateCrossAccess(GeneratorSettings settings, SchemaModel schema, SchemaModel remoteSchema)
        {
            //set the right target namespace for usings
            settings.Namespace = settings.OutputPath;
            if (!settings.Namespace.StartsWith("Xbim."))
            {
                settings.Namespace = "Xbim." + settings.Namespace;
            }
            settings.CrossAccessNamespace = settings.CrossAccessProjectPath + "." + settings.SchemaInterfacesNamespace;

            var entityMatches = EntityDefinitionMatch.GetMatches(schema, remoteSchema).ToList();

            var templates =
                entityMatches.Where(m => m.Target != null)
                .Select(m => new EntityInterfaceImplementation(settings, m, entityMatches) as ICodeTemplate);
            var selectTemplates =
                GetSelectsToImplement(schema, remoteSchema, entityMatches)
                .Select(s => new SelectInterfaceImplementation(settings, s.Item1, s.Item2));
            var infrastructureTemplates = new ICodeTemplate[] { new CreatorTemplate(settings, entityMatches) };

            var toProcess = templates.Concat(selectTemplates); //.Concat(infrastructureTemplates).ToList();

            //toProcess.ForEach(t => ProcessTemplate(t, settings.Namespace));
            Parallel.ForEach(toProcess, t => ProcessTemplate(t, settings.Namespace));

            return(true);
        }
예제 #2
0
 public EntityInterfaceImplementation(GeneratorSettings settings, EntityDefinitionMatch match, List <EntityDefinitionMatch> matches) : base(settings, match.Source)
 {
     _match     = match;
     _matches   = matches;
     RemoteType = match.Target;
     AllRemoteExplicitAttributes = RemoteType.AllExplicitAttributes.ToList();
 }
예제 #3
0
        private static void PrintNewTypesInDomains(SchemaModel current, SchemaModel previous, DomainStructure namespaces)
        {
            var newEntities = EntityDefinitionMatch.GetMatches(current, previous)
                              .Where(m => m.MatchType == EntityMatchType.NotFound)
                              .Select(m => {
                var ns = namespaces.Domains.FirstOrDefault(d => d.Types.Any(t => t == m.Source.Name))?.Name ?? "No namespace";
                return(new { Entity = m.Source, Domain = ns });
            })
                              .GroupBy(m => m.Domain);

            foreach (var group in newEntities)
            {
                Console.WriteLine($"Namespace: {group.Key}");
                foreach (var item in group)
                {
                    Console.WriteLine($"    {item.Entity.Name}");
                }
            }
        }
예제 #4
0
        private static void PrintNewRepresentationTypes(SchemaModel current, SchemaModel previous)
        {
            var newRepresentations = EntityDefinitionMatch.GetMatches(current, previous)
                                     .Where(m => m.MatchType == EntityMatchType.NotFound)
                                     .Where(m => m.Source.AllSupertypes.Any(s => s.Name == "IfcRepresentationItem"));


            Console.WriteLine($"New representation types:");
            foreach (var entity in newRepresentations)
            {
                Console.WriteLine($"{entity.Source.Name}");
            }

            var newPlacementTypes = EntityDefinitionMatch.GetMatches(current, previous)
                                    .Where(m => m.MatchType == EntityMatchType.NotFound)
                                    .Where(m => m.Source.AllSupertypes.Any(s => s.Name == "IfcObjectPlacement"));


            Console.WriteLine($"New placement types:");
            foreach (var entity in newPlacementTypes)
            {
                Console.WriteLine($"{entity.Source.Name}");
            }
        }