You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -0,0 +1,493 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="EntityStoreSchemaGeneratorDatabaseSchemaLoader.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Data.Common;
|
||||
using System.Data.EntityClient;
|
||||
using System.Data.Entity.Design.Common;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Responsible for Loading Database Schema Information
|
||||
/// </summary>
|
||||
internal class EntityStoreSchemaGeneratorDatabaseSchemaLoader
|
||||
{
|
||||
private readonly EntityConnection _connection;
|
||||
private readonly Version _storeSchemaModelVersion;
|
||||
private readonly string _providerInvariantName;
|
||||
|
||||
public EntityStoreSchemaGeneratorDatabaseSchemaLoader(string providerInvariantName, string connectionString)
|
||||
{
|
||||
Debug.Assert(providerInvariantName != null, "providerInvariantName parameter is null");
|
||||
Debug.Assert(connectionString != null, "connectionString parameter is null");
|
||||
_providerInvariantName = providerInvariantName;
|
||||
_connection = CreateStoreSchemaConnection(providerInvariantName, connectionString, out _storeSchemaModelVersion);
|
||||
}
|
||||
|
||||
private static EntityConnection CreateStoreSchemaConnection(string providerInvariantName, string connectionString, out Version storeSchemaModelVersion)
|
||||
{
|
||||
// We are going to try loading all versions of the store schema model starting from the newest.
|
||||
// The first version of the model that was shipped with EntityFrameworkVersions.Version1 and EntityFrameworkVersions.Version2 is the last one
|
||||
// we try, if it fails to load let the exception to propagate up to the caller.
|
||||
foreach (var version in EntityFrameworkVersions.ValidVersions.Where(v => v > EntityFrameworkVersions.Version2).OrderByDescending(v => v))
|
||||
{
|
||||
try
|
||||
{
|
||||
storeSchemaModelVersion = version;
|
||||
return EntityStoreSchemaGenerator.CreateStoreSchemaConnection(providerInvariantName, connectionString, storeSchemaModelVersion);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore the exception with the current version and try the next one.
|
||||
if (!MetadataUtil.IsCatchableExceptionType(e))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
storeSchemaModelVersion = EntityFrameworkVersions.Version2;
|
||||
return EntityStoreSchemaGenerator.CreateStoreSchemaConnection(providerInvariantName, connectionString, storeSchemaModelVersion);
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
_connection.Open();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_connection.Close();
|
||||
}
|
||||
|
||||
public string ProviderInvariantName
|
||||
{
|
||||
get { return _providerInvariantName; }
|
||||
}
|
||||
|
||||
public Version StoreSchemaModelVersion
|
||||
{
|
||||
get { return _storeSchemaModelVersion; }
|
||||
}
|
||||
|
||||
public FunctionDetailsReader LoadFunctionDetails(IEnumerable<EntityStoreSchemaFilterEntry> filters)
|
||||
{
|
||||
return FunctionDetailsReader.Create(_connection, filters, _storeSchemaModelVersion);
|
||||
}
|
||||
|
||||
public IEnumerable<DataRow> LoadViewDetails(IEnumerable<EntityStoreSchemaFilterEntry> filters)
|
||||
{
|
||||
TableDetailsCollection views = new TableDetailsCollection();
|
||||
return LoadDataTable(
|
||||
ViewDetailSql,
|
||||
rows =>
|
||||
rows
|
||||
.OrderBy(r => r.Field<string>("SchemaName"))
|
||||
.ThenBy(r=>r.Field<string>("TableName"))
|
||||
.ThenBy(r=>r.Field<int>("Ordinal")),
|
||||
views,
|
||||
EntityStoreSchemaFilterObjectTypes.View,
|
||||
filters,
|
||||
ViewDetailAlias);
|
||||
}
|
||||
|
||||
public IEnumerable<DataRow> LoadTableDetails(IEnumerable<EntityStoreSchemaFilterEntry> filters)
|
||||
{
|
||||
TableDetailsCollection table = new TableDetailsCollection();
|
||||
return LoadDataTable(
|
||||
TableDetailSql,
|
||||
rows =>
|
||||
rows
|
||||
.OrderBy(r => r.Field<string>("SchemaName"))
|
||||
.ThenBy(r => r.Field<string>("TableName"))
|
||||
.ThenBy(r => r.Field<int>("Ordinal")),
|
||||
table,
|
||||
EntityStoreSchemaFilterObjectTypes.Table,
|
||||
filters,
|
||||
TableDetailAlias);
|
||||
}
|
||||
|
||||
public IEnumerable<DataRow> LoadFunctionReturnTableDetails(IEnumerable<EntityStoreSchemaFilterEntry> filters)
|
||||
{
|
||||
Debug.Assert(_storeSchemaModelVersion >= EntityFrameworkVersions.Version3, "_storeSchemaModelVersion >= EntityFrameworkVersions.Version3");
|
||||
TableDetailsCollection table = new TableDetailsCollection();
|
||||
return LoadDataTable(
|
||||
FunctionReturnTableDetailSql,
|
||||
rows =>
|
||||
rows
|
||||
.OrderBy(r => r.Field<string>("SchemaName"))
|
||||
.ThenBy(r => r.Field<string>("TableName"))
|
||||
.ThenBy(r => r.Field<int>("Ordinal")),
|
||||
table,
|
||||
EntityStoreSchemaFilterObjectTypes.Function,
|
||||
filters,
|
||||
FunctionReturnTableDetailAlias);
|
||||
}
|
||||
|
||||
public IEnumerable<DataRow> LoadRelationships(IEnumerable<EntityStoreSchemaFilterEntry> filters)
|
||||
{
|
||||
RelationshipDetailsCollection table = new RelationshipDetailsCollection();
|
||||
return LoadDataTable(
|
||||
RelationshipDetailSql,
|
||||
rows =>
|
||||
rows
|
||||
.OrderBy(r => r.Field<string>("RelationshipName"))
|
||||
.ThenBy(r => r.Field<string>("RelationshipId"))
|
||||
.ThenBy(r => r.Field<int>("Ordinal")),
|
||||
table,
|
||||
EntityStoreSchemaFilterObjectTypes.Table,
|
||||
filters,
|
||||
RelationshipDetailFromTableAlias,
|
||||
RelationshipDetailToTableAlias);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The underlying connection that this DbSchemaLoader class is using
|
||||
/// This is used to get the provider manifest information only.
|
||||
/// </summary>
|
||||
public System.Data.Common.DbConnection InnerConnection
|
||||
{
|
||||
get { return _connection.StoreConnection; }
|
||||
}
|
||||
|
||||
internal EntityConnection EntityConnection
|
||||
{
|
||||
get { return _connection; }
|
||||
}
|
||||
|
||||
private IEnumerable<DataRow> LoadDataTable(string sql, Func<IEnumerable<DataRow>, IEnumerable<DataRow>> orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable<EntityStoreSchemaFilterEntry> filters, params string[] filterAliases)
|
||||
{
|
||||
using (EntityCommand command = CreateFilteredCommand(_connection, sql, null, queryTypes, new List<EntityStoreSchemaFilterEntry>(filters), filterAliases))
|
||||
{
|
||||
using (DbDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||
{
|
||||
object[] values = new object[table.Columns.Count];
|
||||
while (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
table.Rows.Add(values);
|
||||
}
|
||||
|
||||
return orderByFunc(table.AsEnumerable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static EntityCommand CreateFilteredCommand(EntityConnection connection, string sql, string orderByClause, EntityStoreSchemaFilterObjectTypes queryTypes, List<EntityStoreSchemaFilterEntry> filters, string[] filterAliases)
|
||||
{
|
||||
EntityCommand command = connection.CreateCommand();
|
||||
command.CommandType = CommandType.Text;
|
||||
command.CommandTimeout = 0;
|
||||
|
||||
if (filters.Count == 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(orderByClause))
|
||||
{
|
||||
command.CommandText = sql + Environment.NewLine + orderByClause;
|
||||
}
|
||||
else
|
||||
{
|
||||
command.CommandText = sql;
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
StringBuilder whereClause = new StringBuilder();
|
||||
foreach (string alias in filterAliases)
|
||||
{
|
||||
StringBuilder allows = new StringBuilder();
|
||||
StringBuilder excludes = new StringBuilder();
|
||||
foreach (EntityStoreSchemaFilterEntry entry in filters)
|
||||
{
|
||||
// only apply filters of the correct type
|
||||
if ((queryTypes & entry.Types) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (entry.Effect == EntityStoreSchemaFilterEffect.Allow)
|
||||
{
|
||||
AddFilterEntry(command, allows, alias, entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(entry.Effect == EntityStoreSchemaFilterEffect.Exclude, "did you add new value?");
|
||||
AddFilterEntry(command, excludes, alias, entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (allows.Length != 0)
|
||||
{
|
||||
if (whereClause.Length != 0)
|
||||
{
|
||||
whereClause.Append(Environment.NewLine);
|
||||
whereClause.Append("AND");
|
||||
whereClause.Append(Environment.NewLine);
|
||||
}
|
||||
whereClause.Append("(");
|
||||
whereClause.Append(allows);
|
||||
whereClause.Append(")");
|
||||
}
|
||||
|
||||
if (excludes.Length != 0)
|
||||
{
|
||||
if (whereClause.Length != 0)
|
||||
{
|
||||
whereClause.Append(Environment.NewLine);
|
||||
whereClause.Append("AND");
|
||||
whereClause.Append(Environment.NewLine);
|
||||
}
|
||||
whereClause.Append("NOT (");
|
||||
whereClause.Append(excludes);
|
||||
whereClause.Append(")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// did we end up with a where clause?
|
||||
StringBuilder sqlStatement = new StringBuilder(sql);
|
||||
if (whereClause.Length != 0)
|
||||
{
|
||||
sqlStatement.Append(Environment.NewLine);
|
||||
sqlStatement.Append("WHERE");
|
||||
sqlStatement.Append(Environment.NewLine);
|
||||
sqlStatement.Append(whereClause);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(orderByClause))
|
||||
{
|
||||
sqlStatement.Append(Environment.NewLine);
|
||||
sqlStatement.Append(orderByClause);
|
||||
}
|
||||
|
||||
command.CommandText = sqlStatement.ToString();
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
private static void AddFilterEntry(EntityCommand command, StringBuilder segment, string alias, EntityStoreSchemaFilterEntry entry)
|
||||
{
|
||||
|
||||
StringBuilder filterText = new StringBuilder();
|
||||
AddComparison(command, filterText, alias, "CatalogName", entry.Catalog);
|
||||
AddComparison(command, filterText, alias, "SchemaName", entry.Schema);
|
||||
|
||||
string name = entry.Name;
|
||||
bool allNull = (entry.Catalog == null && entry.Schema == null && entry.Name == null);
|
||||
if (allNull)
|
||||
{
|
||||
name = "%";
|
||||
}
|
||||
AddComparison(command, filterText, alias, "Name", name);
|
||||
|
||||
if (segment.Length != 0)
|
||||
{
|
||||
segment.Append(" OR ");
|
||||
}
|
||||
segment.Append("(");
|
||||
segment.Append(filterText);
|
||||
segment.Append(")");
|
||||
}
|
||||
|
||||
private static void AddComparison(EntityCommand command, StringBuilder segment, string alias, string propertyName, string value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (segment.Length != 0)
|
||||
{
|
||||
segment.Append(" AND ");
|
||||
}
|
||||
|
||||
segment.Append(alias);
|
||||
segment.Append(".");
|
||||
segment.Append(propertyName);
|
||||
segment.Append(" LIKE @");
|
||||
string parameterName = "p" + command.Parameters.Count.ToString(CultureInfo.InvariantCulture);
|
||||
segment.Append(parameterName);
|
||||
EntityParameter parameter = new EntityParameter();
|
||||
parameter.ParameterName = parameterName;
|
||||
parameter.Value = value;
|
||||
command.Parameters.Add(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string ViewDetailAlias = "v";
|
||||
private static readonly string ViewDetailSql = @"
|
||||
SELECT
|
||||
v.CatalogName
|
||||
, v.SchemaName
|
||||
, v.Name
|
||||
, v.ColumnName
|
||||
, v.Ordinal
|
||||
, v.IsNullable
|
||||
, v.TypeName
|
||||
, v.MaxLength
|
||||
, v.Precision
|
||||
, v.DateTimePrecision
|
||||
, v.Scale
|
||||
, v.IsIdentity
|
||||
, v.IsStoreGenerated
|
||||
, CASE WHEN pk.IsPrimaryKey IS NULL THEN false ELSE pk.IsPrimaryKey END as IsPrimaryKey
|
||||
FROM (
|
||||
SELECT
|
||||
v.CatalogName
|
||||
, v.SchemaName
|
||||
, v.Name
|
||||
, c.Id as ColumnId
|
||||
, c.Name as ColumnName
|
||||
, c.Ordinal
|
||||
, c.IsNullable
|
||||
, c.ColumnType.TypeName as TypeName
|
||||
, c.ColumnType.MaxLength as MaxLength
|
||||
, c.ColumnType.Precision as Precision
|
||||
, c.ColumnType.DateTimePrecision as DateTimePrecision
|
||||
, c.ColumnType.Scale as Scale
|
||||
, c.IsIdentity
|
||||
, c.IsStoreGenerated
|
||||
FROM
|
||||
SchemaInformation.Views as v
|
||||
cross apply
|
||||
v.Columns as c ) as v
|
||||
LEFT OUTER JOIN (
|
||||
SELECT
|
||||
true as IsPrimaryKey
|
||||
, pkc.Id
|
||||
FROM
|
||||
OfType(SchemaInformation.ViewConstraints, Store.PrimaryKeyConstraint) as pk
|
||||
CROSS APPLY pk.Columns as pkc) as pk
|
||||
ON v.ColumnId = pk.Id
|
||||
";
|
||||
|
||||
private static readonly string TableDetailAlias = "t";
|
||||
private static readonly string TableDetailSql = @"
|
||||
SELECT
|
||||
t.CatalogName
|
||||
, t.SchemaName
|
||||
, t.Name
|
||||
, t.ColumnName
|
||||
, t.Ordinal
|
||||
, t.IsNullable
|
||||
, t.TypeName
|
||||
, t.MaxLength
|
||||
, t.Precision
|
||||
, t.DateTimePrecision
|
||||
, t.Scale
|
||||
, t.IsIdentity
|
||||
, t.IsStoreGenerated
|
||||
, CASE WHEN pk.IsPrimaryKey IS NULL THEN false ELSE pk.IsPrimaryKey END as IsPrimaryKey
|
||||
FROM (
|
||||
SELECT
|
||||
t.CatalogName
|
||||
, t.SchemaName
|
||||
, t.Name
|
||||
, c.Id as ColumnId
|
||||
, c.Name as ColumnName
|
||||
, c.Ordinal
|
||||
, c.IsNullable
|
||||
, c.ColumnType.TypeName as TypeName
|
||||
, c.ColumnType.MaxLength as MaxLength
|
||||
, c.ColumnType.Precision as Precision
|
||||
, c.ColumnType.DateTimePrecision as DateTimePrecision
|
||||
, c.ColumnType.Scale as Scale
|
||||
, c.IsIdentity
|
||||
, c.IsStoreGenerated
|
||||
FROM
|
||||
SchemaInformation.Tables as t
|
||||
cross apply
|
||||
t.Columns as c ) as t
|
||||
LEFT OUTER JOIN (
|
||||
SELECT
|
||||
true as IsPrimaryKey
|
||||
, pkc.Id
|
||||
FROM
|
||||
OfType(SchemaInformation.TableConstraints, Store.PrimaryKeyConstraint) as pk
|
||||
CROSS APPLY pk.Columns as pkc) as pk
|
||||
ON t.ColumnId = pk.Id
|
||||
";
|
||||
|
||||
private static readonly string FunctionReturnTableDetailAlias = "tvf";
|
||||
private static readonly string FunctionReturnTableDetailSql = @"
|
||||
SELECT
|
||||
tvf.CatalogName
|
||||
, tvf.SchemaName
|
||||
, tvf.Name
|
||||
, tvf.ColumnName
|
||||
, tvf.Ordinal
|
||||
, tvf.IsNullable
|
||||
, tvf.TypeName
|
||||
, tvf.MaxLength
|
||||
, tvf.Precision
|
||||
, tvf.DateTimePrecision
|
||||
, tvf.Scale
|
||||
, false as IsIdentity
|
||||
, false as IsStoreGenerated
|
||||
, false as IsPrimaryKey
|
||||
FROM (
|
||||
SELECT
|
||||
t.CatalogName
|
||||
, t.SchemaName
|
||||
, t.Name
|
||||
, c.Id as ColumnId
|
||||
, c.Name as ColumnName
|
||||
, c.Ordinal
|
||||
, c.IsNullable
|
||||
, c.ColumnType.TypeName as TypeName
|
||||
, c.ColumnType.MaxLength as MaxLength
|
||||
, c.ColumnType.Precision as Precision
|
||||
, c.ColumnType.DateTimePrecision as DateTimePrecision
|
||||
, c.ColumnType.Scale as Scale
|
||||
FROM
|
||||
OfType(SchemaInformation.Functions, Store.TableValuedFunction) as t
|
||||
cross apply
|
||||
t.Columns as c ) as tvf
|
||||
";
|
||||
|
||||
private static readonly string RelationshipDetailFromTableAlias = "r.FromTable";
|
||||
private static readonly string RelationshipDetailToTableAlias = "r.ToTable";
|
||||
private static readonly string RelationshipDetailSql = @"
|
||||
SELECT
|
||||
r.ToTable.CatalogName as ToTableCatalog
|
||||
, r.ToTable.SchemaName as ToTableSchema
|
||||
, r.ToTable.Name as ToTableName
|
||||
, r.ToColumnName
|
||||
, r.FromTable.CatalogName as FromTableCatalog
|
||||
, r.FromTable.SchemaName as FromTableSchema
|
||||
, r.FromTable.Name as FromTableName
|
||||
, r.FromColumnName
|
||||
, r.Ordinal
|
||||
, r.RelationshipName
|
||||
, r.RelationshipId
|
||||
, r.IsCascadeDelete
|
||||
FROM (
|
||||
SELECT
|
||||
fks.ToColumn.Parent as ToTable
|
||||
, fks.ToColumn.Name as ToColumnName
|
||||
, c.Parent as FromTable
|
||||
, fks.FromColumn.Name as FromColumnName
|
||||
, fks.Ordinal as Ordinal
|
||||
, c.Name as RelationshipName
|
||||
, c.Id as RelationshipId
|
||||
, c.DeleteRule = 'CASCADE' as IsCascadeDelete
|
||||
FROM
|
||||
OfType(SchemaInformation.TableConstraints, Store.ForeignKeyConstraint) as c,
|
||||
( SELECT
|
||||
Ref(fk.Constraint) as cRef
|
||||
, fk.ToColumn
|
||||
, fk.FromColumn
|
||||
, fk.Ordinal
|
||||
FROM
|
||||
c.ForeignKeys as fk) as fks
|
||||
WHERE fks.cRef = Ref(c)) as r
|
||||
";
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,133 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="ModelBuilderErrorCodes.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
// This file contains an enum for the errors generated by All the Edm Runtime Tools
|
||||
//
|
||||
// There is almost a one-to-one correspondence between these error codes
|
||||
// and the resource strings - so if you need more insight into what the
|
||||
// error code means, please see the code that uses the particular enum
|
||||
// AND the corresponding resource string
|
||||
//
|
||||
// error numbers end up being hard coded in test cases; they can be removed, but should not be changed.
|
||||
// reusing error numbers is probably OK, but not recommended.
|
||||
//
|
||||
// The acceptable range for this enum is
|
||||
// 6000 - 6999
|
||||
//
|
||||
// The Range 10,000-15,000 is reserved for tools
|
||||
//
|
||||
internal enum ModelBuilderErrorCode
|
||||
{
|
||||
BaseValue = 6000,
|
||||
|
||||
/// <summary>
|
||||
/// was unable to find an entity container that
|
||||
/// the the type should go into
|
||||
/// </summary>
|
||||
RelationshipSpansSchemas = BaseValue + 1,
|
||||
|
||||
/// <summary>
|
||||
/// No primary key is defined for the table
|
||||
/// </summary>
|
||||
NoPrimaryKeyDefined = BaseValue + 2,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown error
|
||||
/// </summary>
|
||||
UnknownError = BaseValue + 3,
|
||||
|
||||
/// <summary>
|
||||
/// The entity referenced by the relationship was
|
||||
/// not found in database
|
||||
/// </summary>
|
||||
MissingEntity = BaseValue + 4,
|
||||
/// <summary>
|
||||
/// The entity referenced by the relationship was
|
||||
/// not found in database
|
||||
/// </summary>
|
||||
UnsupportedType = BaseValue + 5,
|
||||
/// <summary>
|
||||
/// The value given for the facet does not
|
||||
/// fit in the range given by the facet description
|
||||
/// </summary>
|
||||
FacetValueOutOfRange = BaseValue + 6,
|
||||
/// <summary>
|
||||
/// The association must be skipped because a neede key column
|
||||
/// is missing
|
||||
/// </summary>
|
||||
AssociationMissingKeyColumn = BaseValue + 7,
|
||||
/// <summary>
|
||||
/// PrimaryKey of a table cannot be the foreignKey in a relationship
|
||||
/// </summary>
|
||||
PrimaryKeyCannotBeForeignKey = BaseValue + 8,
|
||||
/// <summary>
|
||||
/// Found an usupported one to one association
|
||||
/// </summary>
|
||||
OneToOneAssociationFound = BaseValue + 9,
|
||||
/// <summary>
|
||||
/// The ClientAutoGenerated facet can only be set true on properties of type int16, int32, or in64.
|
||||
/// All other types that have the ServerGeneratedPattern on the store property will not
|
||||
/// get the ClientAutoGenerated facet set.
|
||||
/// </summary>
|
||||
ClientAutoGenNotAllowed = BaseValue + 10,
|
||||
/// <summary>
|
||||
/// concepts that model generator can't handle
|
||||
/// </summary>
|
||||
UnsupportedModelGenerationConcept = BaseValue + 11,
|
||||
/// <summary>A value other than IN, OUT, or INOUT was given</summary>
|
||||
ParameterDirectionNotValid = BaseValue + 12,
|
||||
/// <summary>
|
||||
/// Cannot create entity type without keys. The system tried to infer a candidate key from the existing columns
|
||||
/// and create a read-only view but there are no combination of existing columns that could be used to make
|
||||
/// a candidate key.
|
||||
/// </summary>
|
||||
CannotCreateEntityWithoutPrimaryKey = BaseValue + 13,
|
||||
/// <summary>No types were available to determine the namespace from</summary>
|
||||
CodeGenNamespaceCannotBeDetermined = BaseValue + 14,
|
||||
/// <summary>There is a problem with the sourceFilePath provided to codegen</summary>
|
||||
CodeGenSourceFilePathIsInvalid = BaseValue + 15,
|
||||
/// <summary>There is a problem with the sourceFilePath provided to codegen</summary>
|
||||
CodeGenAdditionalEdmSchemaIsInvalid = BaseValue + 16,
|
||||
/// <summary>The navigation property created a generated property name that conflicts with a real property</summary>
|
||||
GeneratedNavigationPropertyNameConflict = BaseValue + 17,
|
||||
/// <summary>Invalid Attribute Supplied For Property</summary>
|
||||
InvalidAttributeSuppliedForProperty = BaseValue + 18,
|
||||
SecurityError = BaseValue + 19,
|
||||
FileNotFound = BaseValue + 20,
|
||||
DirectoryNotFound = BaseValue + 21,
|
||||
IOException = BaseValue + 22,
|
||||
IncompatibleSettingForCaseSensitiveOption = BaseValue + 23,
|
||||
InvalidAttributeSuppliedForType = BaseValue + 24,
|
||||
InvalidMemberSuppliedForType = BaseValue + 25,
|
||||
InvalidInterfaceSuppliedForType = BaseValue + 26,
|
||||
InvalidGetStatementSuppliedForProperty = BaseValue + 27,
|
||||
InvalidSetStatementSuppliedForProperty = BaseValue + 28,
|
||||
GeneratedFactoryMethodNameConflict = BaseValue + 29,
|
||||
UnsupportedForeinKeyPattern = BaseValue + 30,
|
||||
ExcludedColumnWasAKeyColumn = BaseValue + 31,
|
||||
InvalidKeyTypeFound = BaseValue + 32,
|
||||
GeneratedPropertyAccessibilityConflict = BaseValue + 33,
|
||||
DuplicateClassName = BaseValue + 34,
|
||||
UnsupportedDbRelationship = BaseValue + 35,
|
||||
EntityTypeAndSetAccessibilityConflict = BaseValue + 36,
|
||||
SharedForeignKey = BaseValue + 37,
|
||||
SchemaVersionHigherThanTargetVersion = BaseValue + 38,
|
||||
PreprocessTemplateTransformationError = BaseValue + 39,
|
||||
PreprocessTemplateCompilationError = BaseValue + 40,
|
||||
UnableToGenerateForeignKeyPropertiesForV1 = BaseValue + 41,
|
||||
SourceSchemaIsInvalid = BaseValue + 42,
|
||||
TargetVersionNotSupported = BaseValue + 43,
|
||||
/// <summary>
|
||||
/// The tvf return table info was not found in database
|
||||
/// </summary>
|
||||
MissingTvfReturnTable = BaseValue + 44,
|
||||
UnableToGenerateFunctionImportParameterName = BaseValue + 45,
|
||||
}
|
||||
}
|
@ -0,0 +1,304 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="RelationshipDetailsCollection.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly type data table for holding the RelationshipDetails
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal sealed class RelationshipDetailsCollection : System.Data.DataTable, System.Collections.IEnumerable
|
||||
{
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnPKCatalog;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnPKSchema;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnPKTable;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnPKColumn;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFKCatalog;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFKSchema;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFKTable;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFKColumn;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnOrdinal;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnRelationshipName;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnRelationshipId;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnRelationshipIsCascadeDelete;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a RelationsipDetailsDataTable
|
||||
/// </summary>
|
||||
public RelationshipDetailsCollection()
|
||||
{
|
||||
this.TableName = "RelationshipDetails";
|
||||
// had to remove these because of an fxcop violation
|
||||
//BeginInit();
|
||||
InitClass();
|
||||
//EndInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance RelationshipDetailDataTable with a given SerializationInfo and StreamingContext
|
||||
/// </summary>
|
||||
/// <param name="serializationInfo"></param>
|
||||
/// <param name="streamingContext"></param>
|
||||
internal RelationshipDetailsCollection(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)
|
||||
: base(serializationInfo, streamingContext)
|
||||
{
|
||||
UpdateMemberFieldsAfterDeserialization();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkCatalog column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn PKCatalogColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnPKCatalog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkSchema column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn PKSchemaColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnPKSchema;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkTable column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn PKTableColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnPKTable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkColumn column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn PKColumnColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnPKColumn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkCatalog column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn FKCatalogColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnFKCatalog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkSchema column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn FKSchemaColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnFKSchema;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkTable column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn FKTableColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnFKTable;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkColumn column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn FKColumnColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnFKColumn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Ordinal column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn OrdinalColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnOrdinal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the RelationshipName column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn RelationshipNameColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnRelationshipName;
|
||||
}
|
||||
}
|
||||
|
||||
public System.Data.DataColumn RelationshipIdColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnRelationshipId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsCascadeDelete value
|
||||
/// </summary>
|
||||
public System.Data.DataColumn RelationshipIsCascadeDeleteColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnRelationshipIsCascadeDelete;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerator over the rows.
|
||||
/// </summary>
|
||||
/// <returns>The row enumerator</returns>
|
||||
public System.Collections.IEnumerator GetEnumerator()
|
||||
{
|
||||
return this.Rows.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of this table
|
||||
/// </summary>
|
||||
/// <returns>The newly created instance.</returns>
|
||||
protected override System.Data.DataTable CreateInstance()
|
||||
{
|
||||
return new RelationshipDetailsCollection();
|
||||
}
|
||||
|
||||
private const string PK_CATALOG = "PkCatalog";
|
||||
private const string PK_SCHEMA = "PkSchema";
|
||||
private const string PK_TABLE = "PkTable";
|
||||
private const string PK_COLUMN = "PkColumn";
|
||||
private const string FK_CATALOG = "FkCatalog";
|
||||
private const string FK_SCHEMA = "FkSchema";
|
||||
private const string FK_TABLE = "FkTable";
|
||||
private const string FK_COLUMN = "FkColumn";
|
||||
private const string ORDINAL = "Ordinal";
|
||||
private const string RELATIONSHIP_NAME = "RelationshipName";
|
||||
private const string RELATIONSHIP_ID = "RelationshipId";
|
||||
private const string RELATIONSHIP_IsCascadeDelete = "IsCascadeDelete";
|
||||
|
||||
private void InitClass()
|
||||
{
|
||||
this._columnPKCatalog = new System.Data.DataColumn(PK_CATALOG, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnPKCatalog);
|
||||
this._columnPKSchema = new System.Data.DataColumn(PK_SCHEMA, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnPKSchema);
|
||||
this._columnPKTable = new System.Data.DataColumn(PK_TABLE, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnPKTable);
|
||||
this._columnPKColumn = new System.Data.DataColumn(PK_COLUMN, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnPKColumn);
|
||||
this._columnFKCatalog = new System.Data.DataColumn(FK_CATALOG, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFKCatalog);
|
||||
this._columnFKSchema = new System.Data.DataColumn(FK_SCHEMA, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFKSchema);
|
||||
this._columnFKTable = new System.Data.DataColumn(FK_TABLE, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFKTable);
|
||||
this._columnFKColumn = new System.Data.DataColumn(FK_COLUMN, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFKColumn);
|
||||
this._columnOrdinal = new System.Data.DataColumn(ORDINAL, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnOrdinal);
|
||||
this._columnRelationshipName = new System.Data.DataColumn(RELATIONSHIP_NAME, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnRelationshipName);
|
||||
this._columnRelationshipId = new System.Data.DataColumn(RELATIONSHIP_ID, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnRelationshipId);
|
||||
this._columnRelationshipIsCascadeDelete = new System.Data.DataColumn(RELATIONSHIP_IsCascadeDelete, typeof(bool), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnRelationshipIsCascadeDelete);
|
||||
}
|
||||
|
||||
private void UpdateMemberFieldsAfterDeserialization()
|
||||
{
|
||||
this._columnPKCatalog = base.Columns[PK_CATALOG];
|
||||
this._columnPKSchema = base.Columns[PK_SCHEMA];
|
||||
this._columnPKTable = base.Columns[PK_TABLE];
|
||||
this._columnPKColumn = base.Columns[PK_COLUMN];
|
||||
this._columnFKCatalog = base.Columns[FK_CATALOG];
|
||||
this._columnFKSchema = base.Columns[FK_SCHEMA];
|
||||
this._columnFKTable = base.Columns[FK_TABLE];
|
||||
this._columnFKColumn = base.Columns[FK_COLUMN];
|
||||
this._columnOrdinal = base.Columns[ORDINAL];
|
||||
this._columnRelationshipName = base.Columns[RELATIONSHIP_NAME];
|
||||
this._columnRelationshipId = base.Columns[RELATIONSHIP_ID];
|
||||
this._columnRelationshipIsCascadeDelete = base.Columns[RELATIONSHIP_IsCascadeDelete];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new row from a DataRowBuilder object.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder to create the row from.</param>
|
||||
/// <returns>The row that was created.</returns>
|
||||
protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder)
|
||||
{
|
||||
return new RelationshipDetailsRow(builder);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Type that this row is.
|
||||
/// </summary>
|
||||
/// <returns>The type of this row.</returns>
|
||||
protected override System.Type GetRowType()
|
||||
{
|
||||
return typeof(RelationshipDetailsRow);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,398 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="RelationshipDetailsRow.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
using System.Data.Entity.Design.Common;
|
||||
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed RelationshipDetail row
|
||||
/// </summary>
|
||||
internal sealed class RelationshipDetailsRow : System.Data.DataRow
|
||||
{
|
||||
|
||||
private RelationshipDetailsCollection _tableRelationshipDetails;
|
||||
|
||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
internal RelationshipDetailsRow(System.Data.DataRowBuilder rb)
|
||||
: base(rb)
|
||||
{
|
||||
this._tableRelationshipDetails = ((RelationshipDetailsCollection)(base.Table));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a strongly typed table
|
||||
/// </summary>
|
||||
public new RelationshipDetailsCollection Table
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tableRelationshipDetails;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkCatalog column value
|
||||
/// </summary>
|
||||
public string PKCatalog
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.PKCatalogColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.PKCatalogColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.PKCatalogColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkSchema column value
|
||||
/// </summary>
|
||||
public string PKSchema
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.PKSchemaColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.PKSchemaColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.PKSchemaColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkTable column value
|
||||
/// </summary>
|
||||
public string PKTable
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.PKTableColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.PKTableColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.PKTableColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PkColumn column value
|
||||
/// </summary>
|
||||
public string PKColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.PKColumnColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.PKColumnColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.PKColumnColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkCatalog column value
|
||||
/// </summary>
|
||||
public string FKCatalog
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.FKCatalogColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.FKCatalogColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.FKCatalogColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkSchema column value
|
||||
/// </summary>
|
||||
public string FKSchema
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.FKSchemaColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.FKSchemaColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.FKSchemaColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkTable column value
|
||||
/// </summary>
|
||||
public string FKTable
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.FKTableColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.FKTableColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.FKTableColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FkColumn column value
|
||||
/// </summary>
|
||||
public string FKColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.FKColumnColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.FKColumnColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.FKColumnColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Ordinal column value
|
||||
/// </summary>
|
||||
public int Ordinal
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((int)(this[this._tableRelationshipDetails.OrdinalColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.OrdinalColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.OrdinalColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the RelationshipName column value
|
||||
/// </summary>
|
||||
public string RelationshipName
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.RelationshipNameColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.RelationshipNameColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.RelationshipNameColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the RelationshipName column value
|
||||
/// </summary>
|
||||
public string RelationshipId
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableRelationshipDetails.RelationshipIdColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.RelationshipIdColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.RelationshipIdColumn] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the IsCascadeDelete column value
|
||||
/// </summary>
|
||||
public bool RelationshipIsCascadeDelete
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((bool)(this[this._tableRelationshipDetails.RelationshipIsCascadeDeleteColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableRelationshipDetails.RelationshipIsCascadeDeleteColumn.ColumnName, _tableRelationshipDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableRelationshipDetails.RelationshipIsCascadeDeleteColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the PkCatalog column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsPKCatalogNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.PKCatalogColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the PkSchema column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsPKSchemaNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.PKSchemaColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the PkTable column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsPKTableNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.PKTableColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the PkColumn column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsPKColumnNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.PKColumnColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the FkCatalog column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsFKCatalogNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.FKCatalogColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the FkSchema column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsFKSchemaNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.FKSchemaColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the FkTable column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsFKTableNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.FKTableColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the FkColumn column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsFKColumnNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.FKColumnColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Ordinal column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsOrdinalNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.OrdinalColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the RelationshipName column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsRelationshipNameNull()
|
||||
{
|
||||
return this.IsNull(this._tableRelationshipDetails.RelationshipNameColumn);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,322 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="TableDetailsCollection.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed DataTable for TableDetails
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal sealed class TableDetailsCollection : System.Data.DataTable, System.Collections.IEnumerable
|
||||
{
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnCatalog;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnSchema;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnTable;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFieldOrdinal;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnFieldColumn;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnIsNullable;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnDataType;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnMaximumLength;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnDateTimePrecision;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnPrecision;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnScale;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnIsIdentity;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnIsServerGenerated;
|
||||
[NonSerialized]
|
||||
private System.Data.DataColumn _columnIsPrimaryKey;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a TableDetailsDataTable
|
||||
/// </summary>
|
||||
public TableDetailsCollection()
|
||||
{
|
||||
this.TableName = "TableDetails";
|
||||
// had to remove these because of an fxcop violation
|
||||
//BeginInit();
|
||||
InitClass();
|
||||
//EndInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance TableDetailsDataTable with a given SerializationInfo and StreamingContext
|
||||
/// </summary>
|
||||
/// <param name="serializationInfo"></param>
|
||||
/// <param name="streamingContext"></param>
|
||||
internal TableDetailsCollection(System.Runtime.Serialization.SerializationInfo serializationInfo,
|
||||
System.Runtime.Serialization.StreamingContext streamingContext)
|
||||
: base(serializationInfo, streamingContext)
|
||||
{
|
||||
UpdateMemberFieldsAfterDeserialization();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Catalog column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn CatalogColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnCatalog;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Schema column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn SchemaColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnSchema;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TableName column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn TableNameColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnTable;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ColumnName column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn ColumnNameColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnFieldColumn;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsNullable column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn IsNullableColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnIsNullable;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DataType column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn DataTypeColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnDataType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MaximumLength column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn MaximumLengthColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnMaximumLength;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Precision column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn PrecisionColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnPrecision;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Precision column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn DateTimePrecisionColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnDateTimePrecision;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Scale column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn ScaleColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnScale;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsIdentityColumn column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn IsIdentityColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnIsIdentity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsIdentityColumn column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn IsServerGeneratedColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnIsServerGenerated;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsPrimaryKey column
|
||||
/// </summary>
|
||||
public System.Data.DataColumn IsPrimaryKeyColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._columnIsPrimaryKey;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerator over the rows.
|
||||
/// </summary>
|
||||
/// <returns>The row enumerator</returns>
|
||||
public System.Collections.IEnumerator GetEnumerator()
|
||||
{
|
||||
return this.Rows.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of this table
|
||||
/// </summary>
|
||||
/// <returns>The newly created instance.</returns>
|
||||
protected override System.Data.DataTable CreateInstance()
|
||||
{
|
||||
return new TableDetailsCollection();
|
||||
}
|
||||
|
||||
private const string CATALOG = "CatalogName";
|
||||
private const string SCHEMA = "SchemaName";
|
||||
private const string TABLE = "TableName";
|
||||
private const string COLUMN = "ColumnName";
|
||||
private const string ORDINAL = "Ordinal";
|
||||
private const string IS_NULLABLE = "IsNullable";
|
||||
private const string DATA_TYPE = "DataType";
|
||||
private const string MAX_LENGTH = "MaximumLength";
|
||||
private const string PRECISION = "Precision";
|
||||
private const string DATETIMEPRECISION = "DateTimePrecision";
|
||||
private const string SCALE = "Scale";
|
||||
private const string IS_IDENTITY = "IsIdentity";
|
||||
private const string IS_SERVERGENERATED = "IsServerGenerated";
|
||||
private const string IS_PRIMARYKEY = "IsPrimaryKey";
|
||||
|
||||
private void InitClass()
|
||||
{
|
||||
this._columnCatalog = new System.Data.DataColumn(CATALOG, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnCatalog);
|
||||
this._columnSchema = new System.Data.DataColumn(SCHEMA, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnSchema);
|
||||
this._columnTable = new System.Data.DataColumn(TABLE, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnTable);
|
||||
this._columnFieldColumn = new System.Data.DataColumn(COLUMN, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFieldColumn);
|
||||
this._columnFieldOrdinal = new System.Data.DataColumn(ORDINAL, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnFieldOrdinal);
|
||||
this._columnIsNullable = new System.Data.DataColumn(IS_NULLABLE, typeof(bool), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnIsNullable);
|
||||
this._columnDataType = new System.Data.DataColumn(DATA_TYPE, typeof(string), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnDataType);
|
||||
this._columnMaximumLength = new System.Data.DataColumn(MAX_LENGTH, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnMaximumLength);
|
||||
this._columnPrecision = new System.Data.DataColumn(PRECISION, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnPrecision);
|
||||
this._columnDateTimePrecision = new System.Data.DataColumn(DATETIMEPRECISION, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnDateTimePrecision);
|
||||
this._columnScale = new System.Data.DataColumn(SCALE, typeof(int), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnScale);
|
||||
this._columnIsIdentity = new System.Data.DataColumn(IS_IDENTITY, typeof(bool), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnIsIdentity);
|
||||
this._columnIsServerGenerated = new System.Data.DataColumn(IS_SERVERGENERATED, typeof(bool), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnIsServerGenerated);
|
||||
this._columnIsPrimaryKey = new System.Data.DataColumn(IS_PRIMARYKEY, typeof(bool), null, System.Data.MappingType.Element);
|
||||
base.Columns.Add(this._columnIsPrimaryKey);
|
||||
}
|
||||
|
||||
private void UpdateMemberFieldsAfterDeserialization()
|
||||
{
|
||||
this._columnCatalog = base.Columns[CATALOG];
|
||||
this._columnSchema = base.Columns[SCHEMA];
|
||||
this._columnTable = base.Columns[TABLE];
|
||||
this._columnFieldColumn = base.Columns[COLUMN];
|
||||
this._columnFieldOrdinal = base.Columns[ORDINAL];
|
||||
this._columnIsNullable = base.Columns[IS_NULLABLE];
|
||||
this._columnDataType = base.Columns[DATA_TYPE];
|
||||
this._columnMaximumLength = base.Columns[MAX_LENGTH];
|
||||
this._columnPrecision = base.Columns[PRECISION];
|
||||
this._columnDateTimePrecision = base.Columns[DATETIMEPRECISION];
|
||||
this._columnScale = base.Columns[SCALE];
|
||||
this._columnIsIdentity = base.Columns[IS_IDENTITY];
|
||||
this._columnIsServerGenerated = base.Columns[IS_SERVERGENERATED];
|
||||
this._columnIsPrimaryKey = base.Columns[IS_PRIMARYKEY];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new row from a DataRowBuilder object.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder to create the row from.</param>
|
||||
/// <returns>The row that was created.</returns>
|
||||
protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder)
|
||||
{
|
||||
return new TableDetailsRow(builder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Type that this row is.
|
||||
/// </summary>
|
||||
/// <returns>The type of this row.</returns>
|
||||
protected override System.Type GetRowType()
|
||||
{
|
||||
return typeof(TableDetailsRow);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,450 @@
|
||||
//---------------------------------------------------------------------
|
||||
// <copyright file="TableDetailsRow.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//---------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Data.Entity.Design.Common;
|
||||
using System.Globalization;
|
||||
using System.Data;
|
||||
|
||||
namespace System.Data.Entity.Design.SsdlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Strongly typed DataTable for TableDetails
|
||||
/// </summary>
|
||||
internal sealed class TableDetailsRow : System.Data.DataRow
|
||||
{
|
||||
|
||||
private TableDetailsCollection _tableTableDetails;
|
||||
|
||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
internal TableDetailsRow(System.Data.DataRowBuilder rb)
|
||||
:
|
||||
base(rb)
|
||||
{
|
||||
this._tableTableDetails = ((TableDetailsCollection)(base.Table));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a strongly typed table
|
||||
/// </summary>
|
||||
public new TableDetailsCollection Table
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tableTableDetails;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Catalog column value
|
||||
/// </summary>
|
||||
public string Catalog
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableTableDetails.CatalogColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.CatalogColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.CatalogColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Schema column value
|
||||
/// </summary>
|
||||
public string Schema
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableTableDetails.SchemaColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.SchemaColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.SchemaColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TableName column value
|
||||
/// </summary>
|
||||
public string TableName
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableTableDetails.TableNameColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.TableNameColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.TableNameColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ColumnName column value
|
||||
/// </summary>
|
||||
public string ColumnName
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableTableDetails.ColumnNameColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.ColumnNameColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.ColumnNameColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsNullable column value
|
||||
/// </summary>
|
||||
public bool IsNullable
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((bool)(this[this._tableTableDetails.IsNullableColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.IsNullableColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.IsNullableColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DataType column value
|
||||
/// </summary>
|
||||
public string DataType
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((string)(this[this._tableTableDetails.DataTypeColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.DataTypeColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.DataTypeColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MaximumLength column value
|
||||
/// </summary>
|
||||
public int MaximumLength
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((int)(this[this._tableTableDetails.MaximumLengthColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.MaximumLengthColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.MaximumLengthColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DateTime Precision column value
|
||||
/// </summary>
|
||||
public int DateTimePrecision
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((int)(this[this._tableTableDetails.DateTimePrecisionColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.DateTimePrecisionColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.DateTimePrecisionColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Precision column value
|
||||
/// </summary>
|
||||
public int Precision
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((int)(this[this._tableTableDetails.PrecisionColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.PrecisionColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.PrecisionColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Scale column value
|
||||
/// </summary>
|
||||
public int Scale
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((int)(this[this._tableTableDetails.ScaleColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.ScaleColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.ScaleColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsServerGenerated column value
|
||||
/// </summary>
|
||||
public bool IsIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((bool)(this[this._tableTableDetails.IsIdentityColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.IsIdentityColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.IsIdentityColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsServerGenerated column value
|
||||
/// </summary>
|
||||
public bool IsServerGenerated
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((bool)(this[this._tableTableDetails.IsServerGeneratedColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.IsServerGeneratedColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.IsServerGeneratedColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IsPrimaryKey column value
|
||||
/// </summary>
|
||||
public bool IsPrimaryKey
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return ((bool)(this[this._tableTableDetails.IsPrimaryKeyColumn]));
|
||||
}
|
||||
catch (System.InvalidCastException e)
|
||||
{
|
||||
throw EDesignUtil.StonglyTypedAccessToNullValue(_tableTableDetails.IsPrimaryKeyColumn.ColumnName, _tableTableDetails.TableName, e);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this[this._tableTableDetails.IsPrimaryKeyColumn] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Catalog column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsCatalogNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.CatalogColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Schema column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsSchemaNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.SchemaColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the DataType column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsDataTypeNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.DataTypeColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the MaximumLength column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsMaximumLengthNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.MaximumLengthColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Precision column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsPrecisionNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.PrecisionColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the DateTime Precision column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsDateTimePrecisionNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.DateTimePrecisionColumn);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Scale column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsScaleNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.ScaleColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the IsIdentity column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsIsIdentityNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.IsIdentityColumn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the IsIdentity column value is null
|
||||
/// </summary>
|
||||
/// <returns>true if the value is null, otherwise false.</returns>
|
||||
public bool IsIsServerGeneratedNull()
|
||||
{
|
||||
return this.IsNull(this._tableTableDetails.IsServerGeneratedColumn);
|
||||
}
|
||||
|
||||
public string GetMostQualifiedTableName()
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (!IsCatalogNull())
|
||||
{
|
||||
name = Catalog;
|
||||
}
|
||||
|
||||
if (!IsSchemaNull())
|
||||
{
|
||||
if (name != string.Empty)
|
||||
{
|
||||
name += ".";
|
||||
}
|
||||
name += Schema;
|
||||
}
|
||||
|
||||
if (name != string.Empty)
|
||||
{
|
||||
name += ".";
|
||||
}
|
||||
|
||||
// TableName is not allowed to be null
|
||||
name += TableName;
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public EntityStoreSchemaGenerator.DbObjectKey CreateDbObjectKey(EntityStoreSchemaGenerator.DbObjectType objectType)
|
||||
{
|
||||
return new EntityStoreSchemaGenerator.DbObjectKey(
|
||||
this[this._tableTableDetails.CatalogColumn],
|
||||
this[this._tableTableDetails.SchemaColumn],
|
||||
this[this._tableTableDetails.TableNameColumn],
|
||||
objectType);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user