public static bool IsChildCorrect(CslaObjectInfoCollection cslaObjects, string parentName, string childName) { var childCandidate = cslaObjects.Find(childName); if (parentName == childCandidate.ParentType) { return(true); } return(false); }
public static bool IsItemCorrect(CslaObjectInfoCollection cslaObjects, string collectionName, string itemName) { var collectionCandidate = cslaObjects.Find(collectionName); if (itemName == collectionCandidate.ItemType) { return(true); } return(false); }
public AssociativeEntity(CslaGeneratorUnit parent) : base(parent) { MainLazyLoad = true; SecondaryLazyLoad = true; MainLoadingScheme = LoadingScheme.ParentLoad; SecondaryLoadingScheme = LoadingScheme.ParentLoad; if (parent != null && parent.Params != null) { Parent = parent; _cslaObjects = Parent.CslaObjects; } }
/// <summary> /// Initializes a new instance of the ObjectFactory class. /// </summary> /// <param name="currentUnit">The current unit.</param> /// <param name="entity">The associative entity.</param> public ObjectRelationsFactory(CslaGeneratorUnit currentUnit, AssociativeEntity entity) { _currentUnit = currentUnit; _cslaObjects = _currentUnit.CslaObjects; _entity = entity; MainObjectInfo = _cslaObjects.Find(_entity.MainObject); MainRootCriteriaProperties = GetCriteriaProperties(MainObjectInfo); if (entity.RelationType == ObjectRelationType.ManyToMany) { SecondaryObjectInfo = _cslaObjects.Find(_entity.SecondaryObject); SecondaryRootCriteriaProperties = GetCriteriaProperties(SecondaryObjectInfo); _associativeTable = FindAssociativeTable(MainObjectInfo, SecondaryObjectInfo); _resultSet = new TableResultSet( _associativeTable.ResultIndex, _associativeTable.Columns, _associativeTable.Type); _dbObject = new TableDataBaseObject( _associativeTable.ObjectCatalog, _associativeTable.ObjectName, _associativeTable.ObjectSchema, _associativeTable.Catalog); } else { var mainItemObjectInfo = _cslaObjects.Find(_entity.MainItemTypeName); _associatedTable = FindAssociatedTable(MainObjectInfo, mainItemObjectInfo); _resultSet = new TableResultSet( _associatedTable.ResultIndex, _associatedTable.Columns, _associatedTable.Type); _dbObject = new TableDataBaseObject( _associatedTable.ObjectCatalog, _associatedTable.ObjectName, _associatedTable.ObjectSchema, _associatedTable.Catalog); } }
public string Validate() { if (_cslaObjects == null) { _cslaObjects = Parent.CslaObjects; } _validationError = string.Empty; if (RelationType == ObjectRelationType.OneToMultiple) { ValidOneToMultiple(); } else { ValidMultipleToMultiple(); } return(_validationError); }
public string Validate() { // TODO: check non root use SelfLoad if (_cslaObjects == null) { _cslaObjects = Parent.CslaObjects; } _validationError = string.Empty; if (RelationType == ObjectRelationType.OneToMany) { ValidOneToMany(); } else { ValidManyToMany(); } return(_validationError); }
public CslaGeneratorUnit() { _cslaObjects = new CslaObjectInfoCollection(); _projectName = "MyProject"; }