protected override string MakeCreateTableScript(MappedClassAttribute info)
        {
            var schema        = info.Schema ?? DefaultSchemaName;
            var identifier    = this.MakeIdentifier(schema, info.Name);
            var columnSection = this.MakeColumnSection(info);
            var pk            = info.Properties.Where(p => p.IncludeInPrimaryKey).ToArray();
            var pkString      = "";

            if (pk.Length > 0)
            {
                pkString = string.Format(",{3}    constraint PK_{0}_{1} primary key({2}){3}",
                                         schema,
                                         info.Name,
                                         string.Join(",", pk.Select(c => c.Name)),
                                         Environment.NewLine);
            }
            return(string.Format(
                       @"if not exists(select * from information_schema.tables where table_schema = '{0}' and table_name = '{1}')
create table {2}(
    {3}{4}
)",
                       schema,
                       info.Name,
                       identifier,
                       columnSection,
                       pkString));
        }
Beispiel #2
0
        protected override string MakeCreateTableScript(MappedClassAttribute info)
        {
            var identifier    = this.MakeIdentifier(info.Schema ?? DefaultSchemaName, info.Name);
            var columnSection = this.MakeColumnSection(info);

            return(string.Format(@"create table if not exists {0} (
    {1})",
                                 identifier,
                                 columnSection));
        }
Beispiel #3
0
 protected override string MakeCreateTableScript(MappedClassAttribute info)
 {
     throw new NotImplementedException();
 }