A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/28955281a1e7b36b09f668f33f7b5e433f6b511b below:

Merge branch 'pgsql' · signumsoftware/framework@2895528 · GitHub

5 5

using System.Linq;

6 6

using System.Text;

7 7

using System.Text.RegularExpressions;

8 +

using Signum.Engine.Engine;

8 9

using Signum.Engine.Maps;

9 10

using Signum.Entities;

10 11

using Signum.Entities.Reflection;

@@ -26,7 +27,7 @@ public class EntityCodeGenerator

26 27 27 28

public virtual void GenerateEntitiesFromDatabaseTables()

28 29

{

29 -

CurrentSchema = Schema.Current;

30 +

CurrentSchema = Schema.Current;

30 31 31 32

var tables = GetTables();

32 33

@@ -70,7 +71,9 @@ protected virtual string GetProjectFolder()

70 71 71 72

protected virtual List<DiffTable> GetTables()

72 73

{

73 -

return SchemaSynchronizer.DefaultGetDatabaseDescription(Schema.Current.DatabaseNames()).Values.ToList();

74 +

return Schema.Current.Settings.IsPostgres ?

75 +

PostgresCatalogSchema.GetDatabaseDescription(Schema.Current.DatabaseNames()).Values.ToList() :

76 +

SysTablesSchema.GetDatabaseDescription(Schema.Current.DatabaseNames()).Values.ToList();

74 77

}

75 78 76 79

protected virtual void GetSolutionInfo(out string solutionFolder, out string solutionName)

@@ -538,7 +541,7 @@ protected virtual string GetTicksColumnAttribute(DiffTable table)

538 541

{

539 542

StringBuilder sb = new StringBuilder();

540 543

sb.Append("TableName(\"" + objectName.Name + "\"");

541 -

if (objectName.Schema != SchemaName.Default)

544 +

if (objectName.Schema != SchemaName.Default(CurrentSchema.Settings.IsPostgres))

542 545

sb.Append(", SchemaName = \"" + objectName.Schema.Name + "\"");

543 546 544 547

if (objectName.Schema.Database != null)

@@ -636,7 +639,7 @@ protected virtual IEnumerable<string> GetPropertyAttributes(DiffTable table, Dif

636 639

parts.Add("Min = " + min);

637 640 638 641

if (col.Length != -1)

639 -

parts.Add("Max = " + col.Length / DiffColumn.BytesPerChar(col.SqlDbType));

642 +

parts.Add("Max = " + col.Length);

640 643 641 644

return "StringLengthValidator(" + parts.ToString(", ") + ")";

642 645

}

@@ -706,7 +709,7 @@ protected virtual bool HasUniqueIndex(DiffTable table, DiffColumn col)

706 709

ix.FilterDefinition == null &&

707 710

ix.Columns.Only()?.Let(ic => ic.ColumnName == col.Name && ic.IsIncluded == false) == true &&

708 711

ix.IsUnique &&

709 -

ix.Type == DiffIndexType.NonClustered);

712 +

ix.IsPrimary);

710 713

}

711 714 712 715

protected virtual string DefaultColumnName(DiffTable table, DiffColumn col)

@@ -743,19 +746,19 @@ protected virtual List<string> GetSqlDbTypeParts(DiffColumn col, Type type)

743 746

{

744 747

List<string> parts = new List<string>();

745 748

var pair = CurrentSchema.Settings.GetSqlDbTypePair(type);

746 -

if (pair.SqlDbType != col.SqlDbType)

747 -

parts.Add("SqlDbType = SqlDbType." + col.SqlDbType);

749 +

if (pair.DbType.SqlServer != col.DbType.SqlServer)

750 +

parts.Add("SqlDbType = SqlDbType." + col.DbType.SqlServer);

748 751 749 -

var defaultSize = CurrentSchema.Settings.GetSqlSize(null, null, pair.SqlDbType);

752 +

var defaultSize = CurrentSchema.Settings.GetSqlSize(null, null, pair.DbType);

750 753

if (defaultSize != null)

751 754

{

752 -

if (!(defaultSize == col.Precision || defaultSize == col.Length / DiffColumn.BytesPerChar(col.SqlDbType) || defaultSize == int.MaxValue && col.Length == -1))

755 +

if (!(defaultSize == col.Precision || defaultSize == col.Length || defaultSize == int.MaxValue && col.Length == -1))

753 756

parts.Add("Size = " + (col.Length == -1 ? "int.MaxValue" :

754 -

col.Length != 0 ? (col.Length / DiffColumn.BytesPerChar(col.SqlDbType)).ToString() :

757 +

col.Length != 0 ? col.Length.ToString() :

755 758

col.Precision != 0 ? col.Precision.ToString() : "0"));

756 759

}

757 760 758 -

var defaultScale = CurrentSchema.Settings.GetSqlScale(null, null, col.SqlDbType);

761 +

var defaultScale = CurrentSchema.Settings.GetSqlScale(null, null, col.DbType);

759 762

if (defaultScale != null)

760 763

{

761 764

if (!(col.Scale == defaultScale))

@@ -801,7 +804,7 @@ protected virtual bool IsLite(DiffTable table, DiffColumn col)

801 804 802 805

protected internal virtual Type GetValueType(DiffColumn col)

803 806

{

804 -

switch (col.SqlDbType)

807 +

switch (col.DbType.SqlServer)

805 808

{

806 809

case SqlDbType.BigInt: return typeof(long);

807 810

case SqlDbType.Binary: return typeof(byte[]);

@@ -834,7 +837,7 @@ protected internal virtual Type GetValueType(DiffColumn col)

834 837

case SqlDbType.Udt: return Schema.Current.Settings.UdtSqlName

835 838

.SingleOrDefaultEx(kvp => StringComparer.InvariantCultureIgnoreCase.Equals(kvp.Value, col.UserTypeName))

836 839

.Key;

837 -

default: throw new NotImplementedException("Unknown translation for " + col.SqlDbType);

840 +

default: throw new NotImplementedException("Unknown translation for " + col.DbType.SqlServer);

838 841

}

839 842

}

840 843

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4