Esempio n. 1
0
        public ContextFactory(
            string typeName,
            string schema)
        {
            var columns = schema
                          .Split(',')
                          .Select(x => x.Split(':'))
                          .Select((x, i) => new Column
            {
                Name     = x[0],
                TypeName = x[1],
                Offset   = i,
            })
                          .ToArray();

            this.context = this.Construct(typeName, columns);
        }
Esempio n. 2
0
        private ContextTemplate Construct(string typeName, Column[] columns)
        {
            var cxt = new ContextTemplate
            {
                Key     = "ID",
                Columns = columns,
            };

            var service = PluralizationService.CreateService(CultureInfo.CurrentCulture);

            if (service.IsPlural(typeName))
            {
                cxt.RowName   = service.Singularize(typeName);
                cxt.TableName = typeName;
            }
            else
            {
                cxt.RowName   = typeName;
                cxt.TableName = service.Pluralize(typeName);
            }

            return(cxt);
        }
Esempio n. 3
0
 public ContextFactory(
     string typeName,
     Column[] columns)
 {
     this.context = this.Construct(typeName, columns);
 }