Using LLBLGen 3.1 (Self Servicing) on SQL Server, how would one execute custom SQL, such as:
- delete from UserPreference
- select * from UserPreference (into a datatable, for example)
Using LLBLGen 3.1 (Self Servicing) on SQL Server, how would one execute custom SQL, such as:
On
While it is true that you can access the low level data readers, etc.. I think it kind of defeats the purpose of using the ORM. If you just want to fill a datatable from a collection (with or without filtering), you can use the static method GetMultiAsDataTable (which you can pass a predicate expression to if you want to do filtering). If you want to replace more complex SQL (very useful for reporting), check out the dynamic lists capabilities:
http://www.llblgen.com/documentation/4.0/LLBLGen%20Pro%20RTF/hh_start.htm
The QuerySpec is an even nicer way to specify a dynamic query and project it:
http://www.llblgen.com/documentation/4.0/LLBLGen%20Pro%20RTF/hh_start.htm
Just noticed this question hadn't been answered. With Self Servicing, you'll probably use the TypedListDAO class.
See: Generated code - Fetching DataReaders and projections, SelfServicing
The TypedListDAO class has what you need to do SQL against your database, and it can automatically do projections onto custom classes for you if you need that (see the article).
But basically, (from memory, so might need some slight adjustments), here's what your code might look like:
OR, use a micro-orm to do your sql, and just use the connection from the TypedListDAO class above Some Light-weight micro-orms, like: Dapper (1 cs file), PetaPoco, Massive, etc...