Loads entities of type EntityType using a custom SQL parameterized Query.
Namespace: Aspectize.CoreAssembly: AspectizeDAL (in AspectizeDAL.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
| C# |
|---|
List<EntityType> GetEntitiesFromSQL<EntityType>( string sql, params Object[] parameters ) where EntityType : new(), Entity, IEntity, IDataWrapper |
| Visual Basic |
|---|
Function GetEntitiesFromSQL(Of EntityType As {New, Entity, IEntity, IDataWrapper}) ( _ sql As String, _ ParamArray parameters As Object() _ ) As List(Of EntityType) |
Parameters
- sql
- Type: System..::..String
The custom SQL parameterized Query string.
- parameters
- Type: array<System..::..Object>[]()[][]
The array of parameters to be passed to the command. Parameter names are built by appending a column name to '@'.
Type Parameters
- EntityType
- Type of Entity to load
Return Value
List of EntityType loaded by the queries
Remarks
Custom query string references physical names.
Examples
string sqlClause = "SELECT * FROM Production.Product where Name Like @Name Or Color = @Color"; List<AdventureWorks.Production.Product> products = dm.GetEntitiesFromSQL<AdventureWorks.Production.Product>(sqlClause, "C%", "Black" );
Dim sqlClause As String = "SELECT * FROM Production.Product where Name Like @Name Or Color = @Color" Dim products As List(Of AdventureWorks.Production.Product) = dm.GetEntitiesFromSQL(Of AdventureWorks.Production.Product)(sqlClause, "C%", "Black")