Пример #1
0
        public void BuildModels()
        {
            using (CoreServiceProvider provider = new CoreServiceProvider())
            {
                string[] tcmUris = provider.GetSchemaIds();
                Repository repository = Repository.Instance;

                ModelBase model = null;
                foreach (string tcmUri in tcmUris)
                {
                    SchemaData schema = provider.GetSchema(tcmUri);
                    Console.WriteLine("Generating {0} model {1}", schema.Purpose, schema.Title);

                    switch (schema.Purpose)
                    {
                        case SchemaPurpose.Component:
                            model = new ComponentModel(tcmUri);
                            repository[model.Id] = model;
                            break;

                        case SchemaPurpose.Embedded:
                            model = new EmbeddedModel(tcmUri);
                            repository[model.Id] = model;
                            break;

                        case SchemaPurpose.Multimedia:
                            model = new MultimediaModel(tcmUri);
                            repository[model.Id] = model;
                            break;
                    }

                    new ModelBuilder(schema, model);
                }
            }
        }
        public EmbeddedGenerator(EmbeddedModel model)
            : base(model)
        {
            UsingsGenerator = new UsingsGenerator(model);
            ConstructorGenerator = new ConstructorGenerator(model);

            GenerateModel();
            GenerateBuilder();
        }