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# |
|---|
void LoadEntitiesFromSQL<EntityType>( string sql, params Object[] parameters ) where EntityType : new(), Entity, IEntity, IDataWrapper |
| Visual Basic |
|---|
Sub LoadEntitiesFromSQL(Of EntityType As {New, Entity, IEntity, IDataWrapper}) ( _ sql As String, _ ParamArray parameters As Object() _ ) |
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
Remarks
Custom query string references physical names.
Examples
string sqlClause = "SELECT * FROM Production.Product where Name Like @Name Or Color = @Color"; dm.LoadEntitiesFromSQL<AdventureWorks.Production.Product>(sqlClause, "C%", "Black" );
Dim sqlClause As String = "SELECT * FROM Production.Product where Name Like @Name Or Color = @Color" dm.LoadEntitiesFromSQL(Of AdventureWorks.Production.Product)(sqlClause, "C%", "Black")