本文整理汇总了C#中IClassDef类的典型用法代码示例。如果您正苦于以下问题:C# IClassDef类的具体用法?C# IClassDef怎么用?C# IClassDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IClassDef类属于命名空间,在下文中一共展示了IClassDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitialiseGrid
/// <summary>
/// Initialises the grid with a specified alternate UI definition for the class,
/// as provided in the ClassDef
/// </summary>
/// <param name="classDef">The Classdef used to initialise the grid</param>
/// <param name="uiDefName">The name of the UI definition</param>
public void InitialiseGrid(IClassDef classDef, string uiDefName)
{
if (classDef == null) throw new ArgumentNullException("classDef");
if (uiDefName == null) throw new ArgumentNullException("uiDefName");
IUIGrid gridDef = GetGridDef((ClassDef) classDef, uiDefName);
InitialiseGrid(classDef, gridDef, uiDefName);
}
示例2: createSuperClassDMXml
private static void createSuperClassDMXml(XmlElement classDMElement, IClassDef DMClass)
{
ISuperClassDef superClassDef = DMClass.SuperClassDef;
if (superClassDef == null) return;
//if (!inheritanceRelationship.HasSuperClass) return;
IClassDef superClassClassDef = superClassDef.SuperClassClassDef;
if (superClassClassDef == null) return;
XmlElement SuperClassDMElement = XmlUtilities.createXmlElement(classDMElement, "superClass");
XmlUtilities.setXmlAttribute(SuperClassDMElement, "class", superClassClassDef.ClassName);
XmlUtilities.setXmlAttribute(SuperClassDMElement, "assembly", superClassClassDef.AssemblyName);
XmlUtilities.setXmlAttribute(SuperClassDMElement, "orMapping", superClassDef.ORMapping,
ORMapping.ClassTableInheritance);
switch (superClassDef.ORMapping)
{
case ORMapping.ClassTableInheritance:
XmlUtilities.setXmlAttribute(SuperClassDMElement, "discriminator", superClassDef.Discriminator, "");
XmlUtilities.setXmlAttribute(SuperClassDMElement, "id", superClassDef.ID, "");
break;
case ORMapping.SingleTableInheritance:
XmlUtilities.setXmlAttribute(SuperClassDMElement, "discriminator", superClassDef.Discriminator, "");
break;
case ORMapping.ConcreteTableInheritance:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例3: GetGridColumnStub
private IUIGridColumn GetGridColumnStub(IClassDef classDef)
{
IUIGridColumn gridColumn = MockRepository.GenerateStub<IUIGridColumn>();
gridColumn.PropertyName = RandomValueGen.GetRandomString();
gridColumn.Stub(column => column.ClassDef).Return(classDef);
return gridColumn;
}
示例4: GetPropDefByPropName
/// <summary>
/// Finds the property definition with the given name for the specified
/// class definition. This method will search through an inheritance
/// structure or relationship if needed.
/// </summary>
/// <param name="classDef">The class definition containing either the property
/// or containing inheritance or relationship structures that might hold
/// the property</param>
/// <param name="propertyName">The name of the property. A related property can
/// be described by "RelationshipName.PropertyName".</param>
/// <returns></returns>
public static IPropDef GetPropDefByPropName(IClassDef classDef, string propertyName)
{
if (classDef == null || IsReflectiveProperty(propertyName))
{
return null;
}
/* if (IsRelatedProperty(propertyName))
{
string relationshipName = propertyName.Substring(0, propertyName.IndexOf("."));
propertyName = propertyName.Remove(0, propertyName.IndexOf(".") + 1);
List<string> relNames = new List<string>();
relNames.AddRange(relationshipName.Split(new[]{"|"}, StringSplitOptions.RemoveEmptyEntries));
IRelationshipDefCol relationshipDefCol = classDef.RelationshipDefCol;
IPropDef propDef = null;
foreach (string relName in relNames)
{
if (relationshipDefCol.Contains(relName))
{
IRelationshipDef relationshipDef = relationshipDefCol[relName];
IClassDef relatedClassDef = relationshipDef.RelatedObjectClassDef;
propDef = GetPropDefByPropName(relatedClassDef, propertyName);
}
if (propDef != null)
{
return propDef;
}
}
return null;
}*/
return classDef.GetPropDef(propertyName, false);
}
示例5: CreateEditorControl
protected override IBOPanelEditorControl CreateEditorControl(IClassDef classDef)
{
if (classDef.ClassName == "OrganisationTestBO")
{
return new BOEditorControlVWG<OrganisationTestBO>();
}
return new BOEditorControlVWG<ContactPersonTestBO>();
}
示例6:
protected override IBOPanelEditorControl CreateEditorControl
(IControlFactory controlFactory, IClassDef classDef, string uiDefName)
{
if (classDef.ClassName == "OrganisationTestBO")
{
return new BOEditorControlVWG<OrganisationTestBO>(controlFactory, uiDefName);
}
return new BOEditorControlVWG<ContactPersonTestBO>(controlFactory, uiDefName);
}
示例7: BOEditorControlWin
///<summary>
/// The Constructor for the <see cref="BOEditorControlWin"/> which passes in the
/// <paramref name="classDef"/> for the <see cref="IBusinessObject"/> and the <paramref name="uiDefName"/> that
/// is used to defined the User Interface for the <see cref="IBusinessObject"/>
///</summary>
///<param name="controlFactory">The control factory which is used to create the Controls on this form.</param>
///<param name="classDef">The <see cref="IClassDef"/> for the <see cref="IBusinessObject"/> that will be edited by this control</param>
///<param name="uiDefName">The user interface defined in the <see cref="IClassDef"/> that will be used to Build this control</param>
public BOEditorControlWin(IControlFactory controlFactory, IClassDef classDef, string uiDefName)
{
if (controlFactory == null) throw new ArgumentNullException("controlFactory");
if (classDef == null) throw new ArgumentNullException("classDef");
if (uiDefName == null) throw new ArgumentNullException("uiDefName");
_panelInfo = BOEditorControlUtils.CreatePanelInfo(controlFactory, classDef, uiDefName, this);
SetEnableState();
}
示例8: CreateUIFilter
public IFilterDef CreateUIFilter(IClassDef classDef)
{
if (classDef==null) throw new ArgumentNullException("classDef");
var filterPropertyDefs = new List<IFilterPropertyDef>();
foreach (var propDef in classDef.PropDefcol)
{
if (propDef.IsPartOfObjectIdentity()) continue;
if (propDef.IsPropForeignKey()) continue;
filterPropertyDefs.Add(CreateUIFilterProperty(propDef));
}
IFilterDef filterDef = _factory.CreateFilterDef(filterPropertyDefs);
return filterDef;
}
示例9: AddAllPropsToQuery
private static void AddAllPropsToQuery(IClassDef classDef, SelectQuery selectQuery)
{
foreach (IPropDef propDef in classDef.PropDefColIncludingInheritance.ToList())
{
if (propDef.Persistable)
{
IClassDef fieldClassDef = classDef;
if (!((ClassDef)classDef).IsUsingConcreteTableInheritance())
fieldClassDef = propDef.ClassDef;
QueryField queryField = CreateQueryField(fieldClassDef, propDef);
selectQuery.Fields.Add(propDef.PropertyName, queryField);
}
}
}
示例10: GetDefaultUIDef
public IUIDef GetDefaultUIDef(IClassDef classDef)
{
if (classDef == null) throw new ArgumentNullException("classDef");
if (classDef.UIDefCol.Contains("default"))
{
return classDef.UIDefCol["default"];
}
IUIForm uiForm = CreateUIForm(classDef);
var uiGrid = CreateUIGrid(classDef);
var uiDef = _factory.CreateUIDef("default", uiForm, uiGrid);
uiDef.ClassDef = classDef;
return uiDef;
}
示例11: GetPropsToInclude
/// <summary>
/// Builds a collection of properties to include in the insertion,
/// depending on the inheritance type.
/// </summary>
protected virtual IBOPropCol GetPropsToInclude(IClassDef currentClassDef)
{
IBOPropCol propsToIncludeTemp = currentClassDef.PropDefcol.CreateBOPropertyCol(true);
IBOPropCol propsToInclude = new BOPropCol();
AddPersistableProps(propsToInclude, propsToIncludeTemp);
while (((ClassDef)currentClassDef).IsUsingSingleTableInheritance() ||
((ClassDef)currentClassDef).IsUsingConcreteTableInheritance())
{
var boPropertyCol = currentClassDef.SuperClassClassDef.PropDefcol.CreateBOPropertyCol(true);
AddPersistableProps(propsToInclude, boPropertyCol);
currentClassDef = currentClassDef.SuperClassClassDef;
}
return propsToInclude;
}
示例12: CreateUIGrid
public IUIGrid CreateUIGrid(IClassDef classDef)
{
IUIGrid uiGrid = _factory.CreateUIGridDef();
//The Properties are loaded in the ordinal position order
// that they occur in the XML ClassDef so this will be the
// correct order they should be shown in the UI.
foreach (var propDef in classDef.PropDefcol)
{
if (propDef.IsPartOfObjectIdentity()) continue;
if (propDef.IsPropForeignKey()) continue;
uiGrid.Add(GetUIGridColumn(propDef));
}
var uiFilterCreator = new UIFilterCreator(_factory);
uiGrid.FilterDef = uiFilterCreator.CreateUIFilter(classDef);
return uiGrid;
}
示例13: LoadClassDef
public static IClassDef LoadClassDef()
{
XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
_newClassDef = itsLoader.LoadClass(@"
<class name=""MultiPropBO"" assembly=""Habanero.Test"">
<property name=""MultiPropBOID"" type=""Guid"" />
<property name=""DateTimeProp"" type=""DateTime"" />
<property name=""StringProp"" />
<property name=""IntProp"" type=""int"" />
<property name=""GuidProp"" type=""Guid"" />
<property name=""DoubleProp"" type=""double"" />
<property name=""SingleProp"" type=""Single"" />
<property name=""TimeSpanProp"" type=""TimeSpan"" />
<primaryKey>
<prop name=""MultiPropBOID"" />
</primaryKey>
</class>
");
ClassDef.ClassDefs.Add(_newClassDef);
return _newClassDef;
}
示例14: CreateUIForm
public IUIForm CreateUIForm(IClassDef classDef)
{
var uiForm = _factory.CreateUIFormDef();
uiForm.Title = classDef.DisplayName + " Form";
var uiFormTab = _factory.CreateUIFormTab();
uiFormTab.Name = "default";
var uiFormColumn = _factory.CreateUIFormColumn();
//The Properties are loaded in the ordinal position order
// that they occur in the XML ClassDef so this will be the
// correct order they should be shown in the UI.
foreach (var propDef in classDef.PropDefcol)
{
if (propDef.IsPartOfObjectIdentity()) continue;
if (propDef.IsPropForeignKey()) continue;
uiFormColumn.Add(GetUIFormField(propDef));
}
uiFormTab.Add(uiFormColumn);
uiForm.Add(uiFormTab);
return uiForm;
}
示例15: SetupTest
public void SetupTest()
{
BORegistry.DataAccessor = new DataAccessorInMemory();
BORegistry.BusinessObjectManager = new BusinessObjectManagerFake();
ClassDef.ClassDefs.Clear();
_cpClassDef = ContactPersonTestBO.LoadClassDefOrganisationTestBORelationship_MultipleReverse();
_orgClassDef = OrganisationTestBO.LoadDefaultClassDef();
}