|
From: <mcu...@us...> - 2011-11-30 07:06:53
|
Revision: 1479
http://orm.svn.sourceforge.net/orm/?rev=1479&view=rev
Author: mcurland
Date: 2011-11-30 07:06:47 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
* Do not treat value types used only be derived fact types as independent: stops table creation for value types used in fully derived fact types.
* Do not display length field for Picture and OleObject data types on relational columns
* Make the column data type read-only for unary fact types, changing this value invalidates the unary fact type pattern.
Modified Paths:
--------------
trunk/AlternateViews/RelationalView/ShapeModel/ColumnElementListCompartment.cs
trunk/ORMModel/ObjectModel/ObjectType.cs
trunk/RelationalModel/DcilModel/Design/ColumnTypeDescriptor.cs
Modified: trunk/AlternateViews/RelationalView/ShapeModel/ColumnElementListCompartment.cs
===================================================================
--- trunk/AlternateViews/RelationalView/ShapeModel/ColumnElementListCompartment.cs 2011-11-30 02:50:15 UTC (rev 1478)
+++ trunk/AlternateViews/RelationalView/ShapeModel/ColumnElementListCompartment.cs 2011-11-30 07:06:47 UTC (rev 1479)
@@ -283,7 +283,7 @@
}
else if (dataType is RawDataDataType)
{
- return ((dataType is FixedLengthRawDataDataType) ? "BINARY" : ((dataType is LargeLengthRawDataDataType) ? "BLOB" : "VARBINARY")) + (precision > 0 ? "(" + precision.ToString() + ")" : null);
+ return ((dataType is FixedLengthRawDataDataType) ? "BINARY" : ((dataType is LargeLengthRawDataDataType) ? "BLOB" : "VARBINARY")) + ((precision > 0 && dataType.LengthName != null) ? "(" + precision.ToString() + ")" : null);
}
else if (dataType is TemporalDataType)
{
Modified: trunk/ORMModel/ObjectModel/ObjectType.cs
===================================================================
--- trunk/ORMModel/ObjectModel/ObjectType.cs 2011-11-30 02:50:15 UTC (rev 1478)
+++ trunk/ORMModel/ObjectModel/ObjectType.cs 2011-11-30 07:06:47 UTC (rev 1479)
@@ -2610,7 +2610,9 @@
{
get
{
- return IsIndependent || (ImpliedMandatoryConstraint == null && AllowIsIndependent(false));
+ bool seenDerived;
+ bool seenNonDerived;
+ return IsIndependent || (ImpliedMandatoryConstraint == null && (AllowIsIndependent(false, out seenDerived, out seenNonDerived) && (seenNonDerived || (seenDerived && !IsValueType))));
}
}
/// <summary>
@@ -2628,7 +2630,26 @@
/// <returns><see langword="true"/> if <see cref="IsIndependent"/> can be turned on.</returns>
private bool AllowIsIndependent(bool throwIfFalse)
{
+ bool dummy1;
+ bool dummy2;
+ return AllowIsIndependent(throwIfFalse, out dummy1, out dummy2);
+ }
+ /// <summary>
+ /// Test if the <see cref="IsIndependent"/> property can be set to true.
+ /// </summary>
+ /// <param name="throwIfFalse">Set to <see langword="true"/> to throw an exception instead of returning false.</param>
+ /// <param name="playsDerivedRole"> Set to <see langword="true"/> if the object type plays a role in a fully derived fact type. Accurate if function returns true.</param>
+ /// <param name="playsNonDerivedRole"> Set to <see langword="true"/> if the object type plays a role in a non-fully derived fact type. Accurate if function returns true.</param>
+ /// <returns><see langword="true"/> if <see cref="IsIndependent"/> can be turned on.</returns>
+ private bool AllowIsIndependent(bool throwIfFalse, out bool playsDerivedRole, out bool playsNonDerivedRole)
+ {
bool retVal = true;
+ playsDerivedRole = false;
+ playsNonDerivedRole = false;
+ if (IsImplicitBooleanValue)
+ {
+ return false;
+ }
LinkedElementCollection<Role> preferredIdentifierRoles = null;
LinkedElementCollection<Role> playedRoles = PlayedRoleCollection;
int playedRoleCount = playedRoles.Count;
@@ -2648,8 +2669,10 @@
// roles on this object type can imply a mandatory on one
// or more of the non-existential roles. This would be an
// unusual way to model the mandatory constraint, however.
+ playsDerivedRole = true;
continue;
}
+ playsNonDerivedRole = true;
LinkedElementCollection<ConstraintRoleSequence> constraints = playedRole.ConstraintRoleSequenceCollection;
int constraintCount = constraints.Count;
for (int j = 0; j < constraintCount; ++j)
Modified: trunk/RelationalModel/DcilModel/Design/ColumnTypeDescriptor.cs
===================================================================
--- trunk/RelationalModel/DcilModel/Design/ColumnTypeDescriptor.cs 2011-11-30 02:50:15 UTC (rev 1478)
+++ trunk/RelationalModel/DcilModel/Design/ColumnTypeDescriptor.cs 2011-11-30 07:06:47 UTC (rev 1479)
@@ -58,6 +58,22 @@
return base.CreatePropertyDescriptor(requestor, domainPropertyInfo, attributes);
}
/// <summary>
+ /// Disallow changing data types for columns based on unary predicates. These must remain boolean.
+ /// </summary>
+ protected override bool IsPropertyDescriptorReadOnly(ElementPropertyDescriptor propertyDescriptor)
+ {
+ Column column;
+ ObjectType valueType;
+ if (propertyDescriptor.DomainPropertyInfo.Id == Column.DataTypeDomainPropertyId &&
+ null != (column = propertyDescriptor.ModelElement as Column) &&
+ null != (valueType = column.AssociatedValueType) &&
+ valueType.IsImplicitBooleanValue)
+ {
+ return true;
+ }
+ return base.IsPropertyDescriptorReadOnly(propertyDescriptor);
+ }
+ /// <summary>
/// An element property descriptor that merges DataType facet properties only if the
/// DataTypes of the multi-selected elements match.
/// </summary>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|