private static Func <object, object, bool> CreateCollectionRemoveFunction( Type type, string propertyName) { Type collectionElementType = EntityUtil.GetCollectionElementType(PocoPropertyAccessorStrategy.GetNavigationPropertyType(type, propertyName)); return((Func <object, object, bool>)PocoPropertyAccessorStrategy.RemoveFromCollectionGeneric.MakeGenericMethod(collectionElementType).Invoke((object)null, (object[])null)); }
public object CollectionCreate(RelatedEnd relatedEnd) { if (this._entity is IEntityWithRelationships) { return((object)relatedEnd); } if (relatedEnd.TargetAccessor.CollectionCreate == null) { Type declaringType = PocoPropertyAccessorStrategy.GetDeclaringType(relatedEnd); string propertyName = relatedEnd.TargetAccessor.PropertyName; Type navigationPropertyType = PocoPropertyAccessorStrategy.GetNavigationPropertyType(declaringType, propertyName); relatedEnd.TargetAccessor.CollectionCreate = PocoPropertyAccessorStrategy.CreateCollectionCreateDelegate(navigationPropertyType, propertyName); } return(relatedEnd.TargetAccessor.CollectionCreate()); }