private void AddRelation(string member, RelationMap relation) { if (EntityMap.GetType(relation.Type) == null) { throw new MappingException("Mapping: Relation type was Invalid - " + relation.Type); } RelationMap[] tempRelations = new RelationMap[this.relations.Length + 1]; this.relations.CopyTo(tempRelations, 0); tempRelations[this.relations.Length] = relation; this.relations = tempRelations; if (!relation.QueryOnly) { this.AddMember(member); } }
// Thanks to both Allan Ritchie ([email protected]) // and Gerrod Thomas (http://www.Gerrod.com) for advice and code public object Resync(object entityObject) { EntityMap entity = this.mappings[entityObject.GetType()]; for (int index = 0; index < entity.RelationCount; index++) { RelationMap relation = entity.Relation(index); object member = this[entityObject].GetField(relation.Member); ILoadOnDemand lazy = member as ILoadOnDemand; if (lazy != null) { if (lazy.IsLoaded) { lazy.Resync(); } } } this.EndTracking(entityObject); EntityKey entityKey = new EntityKey(this, entityObject, true); return(this.GetObject(entityObject.GetType(), entityKey.Value, true)); }
public OrderByJoin(RelationMap relationMap) { this.RelationMap = relationMap; }
private void AddRelation(string member, RelationMap relation) { if (EntityMap.GetType(relation.Type) == null) { throw new MappingException("Mapping: Relation type was Invalid - " + relation.Type); } RelationMap[] tempRelations = new RelationMap[this.relations.Length + 1]; this.relations.CopyTo(tempRelations, 0); tempRelations[this.relations.Length] = relation; this.relations = tempRelations; if (!relation.QueryOnly) this.AddMember(member); }