コード例 #1
0
        private static void AddModel(IColumns databaseObject)
        {
            string schema;

            if (mappingRuleManager.IsIncluded(databaseObject))
            {
                schema = databaseObject.Schema.ToPascalCase();

                if (!mapping.ModelNamespaces.Contains(schema))
                {
                    mapping.ModelNamespaces.Add(new ModelNamespace()
                    {
                        Name = schema
                    });
                }

                Model model = new Model()
                {
                    Namespace   = schema,
                    Name        = mappingRuleManager.TrimPrefix(databaseObject).ToPascalCase().ToSingular(),
                    Description = databaseObject.Description,
                    IsView      = databaseObject is View,
                    MappingName = databaseObject.ToString()
                };

                LoadProperties(model.Properties, databaseObject);

                mapping.ModelNamespaces[schema].Models.Add(model);
            }
        }