private Entity CreateEntity(EntityContext entityContext, TabularObjectBase tableSchema)
        {
            var entity = new Entity
            {
                FullName    = tableSchema.FullName,
                TableName   = tableSchema.Name,
                TableSchema = tableSchema.Owner
            };

            string className = ToClassName(tableSchema.Name);

            className = _namer.UniqueClassName(className);

            string mappingName = className + "Map";

            mappingName = _namer.UniqueClassName(mappingName);

            string contextName = Settings.ContextName(className);

            contextName = ToPropertyName(entityContext.ClassName, contextName);
            contextName = _namer.UniqueContextName(contextName);

            entity.ClassName   = className;
            entity.ContextName = contextName;
            entity.MappingName = mappingName;

            entityContext.Entities.Add(entity);

            return(entity);
        }
示例#2
0
        private Entity CreateEntity(EntityContext entityContext, TableSchema tableSchema)
        {
            var entity = new Entity
            {
                FullName  = tableSchema.FullName,
                TableName = tableSchema.Name,
                //mysql
                TableSchema = entityContext.DatabaseName.ToFirstCamelCase(),
                //mssql
                // TableSchema = tableSchema.Owner,
                Description = tableSchema.Description,
                Context     = entityContext
            };

            Debug.WriteLine("-----------------------------------------------------------" + entity.TableSchema);
            string className = ToClassName(tableSchema.Name);

            className = _namer.UniqueClassName(className);

            string mappingName = className + "Map";

            mappingName = _namer.UniqueClassName(mappingName);

            string contextName = Settings.ContextName(className);

            contextName = ToPropertyName(entityContext.ClassName, contextName);
            contextName = _namer.UniqueContextName(contextName);

            entity.ClassName   = className;
            entity.ContextName = contextName;
            entity.MappingName = mappingName;

            entityContext.Entities.Add(entity);

            return(entity);
        }