/// <summary> /// Returns all properties matching the identifier. /// </summary> /// <param name="type">The type to search the properties in.</param> /// <param name="identifier">The identifier to match the properties.</param> public PropertyBinding[] FindProperty(Type type, Identifier identifier) { if (type == null) { throw ExceptionBuilder.ArgumentNull("type"); } if (identifier == null) { throw ExceptionBuilder.ArgumentNull("identifier"); } // Get property provider responsible for the given type. IPropertyProvider propertyProvider = _propertyProviders[type]; if (propertyProvider == null) { return(new PropertyBinding[0]); } // Get properties from the provider. PropertyBinding[] properties; try { properties = propertyProvider.GetProperties(type); } catch (NQueryException) { throw; } catch (Exception ex) { throw ExceptionBuilder.IPropertyProviderGetPropertiesFailed(ex); } return(FindProperty(properties, identifier)); }
public TableBinding Add(IEnumerable enumerable, Type elementType, string tableName) { if (enumerable == null) { throw ExceptionBuilder.ArgumentNull("enumerable"); } if (elementType == null) { throw ExceptionBuilder.ArgumentNull("elementType"); } if (tableName == null) { throw ExceptionBuilder.ArgumentNull("tableName"); } IPropertyProvider elementPropertyProvider = GetRequiredPropertyProvider(elementType); PropertyBinding[] properties; try { properties = elementPropertyProvider.GetProperties(elementType); } catch (NQueryException) { throw; } catch (Exception ex) { throw ExceptionBuilder.IPropertyProviderGetPropertiesFailed(ex); } EnumerableTableBinding tableBinding = new EnumerableTableBinding(enumerable, elementType, properties, tableName); Add(tableBinding); return(tableBinding); }