Hello!
I need to modify base table structure for DC when application starts.
public override void CustomizeTypesInfo(ITypesInfo typesInfo)
{
base.CustomizeTypesInfo(typesInfo);
foreach (XPClassInfo ClassInfo in typesInfo.PersistentTypes.Where(Item => typeof(Entities.IBaseTrackedEntity).IsAssignableFrom(Item.Type)).Select(Item => XafTypesInfo.XpoTypeInfoSource.XPDictionary.GetClassInfo(Item.Type)))
{
DBColumn IDColumn = ClassInfo.Table.GetColumn(ClassInfo.KeyProperty.MappingField);
IDColumn.IsKey = false;
DBColumn KeyColumn = ClassInfo.Table.GetColumn(@"Code");
KeyColumn.IsKey = true;
ClassInfo.Table.PrimaryKey = new DBPrimaryKey(@"PrimaryKey", new DBColumn[] { KeyColumn });
ClassInfo.Table.ForeignKeys.Clear();
List<DBColumn> PrimaryIndexColumns = new List<DBColumn>();
PrimaryIndexColumns.Add(ClassInfo.Table.GetColumn(@"ID"));
if (typeof(Entities.IBasePeriodTrackedEntity).IsAssignableFrom(ClassInfo.ClassType)) PrimaryIndexColumns.Add(ClassInfo.Table.GetColumn(@"Period"));
PrimaryIndexColumns.Add(ClassInfo.Table.GetColumn(@"Stamp"));
DBIndex PrimaryIndex = new DBIndex(@"PrimaryIndex", PrimaryIndexColumns, false);
if (!ClassInfo.Table.IsIndexIncluded(PrimaryIndex)) ClassInfo.Table.AddIndex(PrimaryIndex);
if (typeof(Entities.IBasePeriodTrackedEntity).IsAssignableFrom(ClassInfo.ClassType))
{
DBIndex PeriodIndex = new DBIndex(@"PeriodIndex", new DBColumn[] { ClassInfo.Table.GetColumn(@"Period"), ClassInfo.Table.GetColumn(@"Stamp") }, false);
if (!ClassInfo.Table.IsIndexIncluded(PeriodIndex)) ClassInfo.Table.AddIndex(PeriodIndex);
}
XafTypesInfo.Instance.RefreshInfo(ClassInfo.ClassType);
}
}
As you can see, im trying to check all PersistentTypes and find the one i need (the ones assignable from Entities.IBaseTrackedEntity interface), then i modify underlying table, accordingly.
It all works for Xpo, but i cant make it work for DC.
How i should modify my implementation to make it work with DC?
Hope to hear from you soon!
Thank you!
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello,
Thank you for contacting us. Unfortunately, this scenario is not currently supported by DC.
See Also:
DC - Provide support for dynamic members in domain components
Thanks,
Dennis