llblgenpro

Standard way to merge Entities in LlblGenPro

I start with an entity A with primary key A1, it has child collections B and C, but they are empty, because I haven't prefetched them. I now get a new occurrence of A (A prime) with primary key A1 with the child collections B and C filled. What is a good way to get the A and A prime to be the same object and to get A collections of B a...

LLBLGen: How can I softdelete a entry

I have inherited a project that uses LLBLGen Pro for the DB layer. The DB model requires that when a entry is deleted a flag (DeletedDate is set to the current time). The last programmer ignored this requirement and has used regular deletes throughout the entire application. Is there a way to set the code generator to do this automatica...

Create (LLBLGen) Linq query dynamicly with strings

Hi, We need to generate LINQ queries which are 100% unknown during coding (design time). This is because the logic is available in our framework which is 100% separated from any data projects. For data we use LLBLGen generated data access code. Normally by using invokes on the DLL, which we specify to the framework (not reference) we c...

LLBL Gen Pro 2.6 and Auditing

I am using LLBL Gen Pro v2.6 and am attempting to create a means of auditing changes made to the database. Now, I know that LLBL Gen has auditing built into it using AuditorBase and dependency injection. The question I have is; I need to track not only the stuff that LLBL Gen exposes as auditable, but also the User who made the changes. ...

Which ORM tool should I use for .Net development

My company is looking to use an ORM for new development in .Net. We are currently looking at nHibernate, because of its popularity, however LLBLGen is another option that we may consider. Cost is not a primary factor. We need a solution that provides good separation of the domain model from the database, a good caching strategy, developm...

How to Design Data Transfer Objects in Business Logic Layer

DTO I'm building a Web application I would like to scale to many users. Also, I need to expose functionality to trusted third parties via Web Services. I'm using LLBLGen to generate the data access layer (using SQL Server 2008). The goal is to build a business logic layer that shields the Web App from the details of DAL and, of course,...

Filtering FetchEntityCollection based on relationship collection count

I currently fetch a collection of jobs like this: jobs = new EntityCollection<JobEntity>(new JobEntityFactory()); var bucket = GetJobsBucket(filter); var tempContext = new Context(); tempContext.Add(jobs); var sorter = new SortExpression(JobFields.Id | SortOperator.Descending); adapter.FetchEntityCollection(jobs, bucket, maxCount, s...

Transaction in LLBLGen Pro

I am using LLBLGen Pro 2.5 with self-servicing. If I want to add some rows into my tables within a transaction and then update the first row I added, do I have to add that first entity into the transaction object again? Here is a fictional example of what I mean: Dim objCustomer as New CustomerEntity() Dim trans as new Transaction(Iso...

Can multiple filters be used on a llblgen data source?

I have the following (sample)code to filter search results from a LLBLGen data source: IPredicateExpression firstFilter = new PredicateExpression(); firstFilter.Add(new FieldLikePredicate(CustomerFields.FirstName, null, txtSearchFirst.Text.Trim() + "%")); llbldsCustomer.FilterToUser = firstFilter; llbldsCustomer.DataBind(); gridview1.Da...

How do I join tables with a condition using LLBLGen?

I have the following Sql Query that returns the type of results that I want: SELECT b.ID, a.Name, b.Col2, b.COl3 FROM Table1 a LEFT OUTER JOIN Table2 b on b.Col4 = a.ID AND b.Col5 = 'test' In essence, I want a number of rows equal to Table1 (a) while having the data from Table2 (b) listed or NULL if the condition, 'test', doesn't exis...

What would this sql query (w count and group by) look like when translated to linq?

How would the following sql query look when translated to linq? SELECT myId, Count(myId) FROM MyTable GROUP BY myId I've tried the following: var q = from a in db.MyTable group a by a.Id into g let count = g.Count() select new { Count = Id, Key= g.Key }; but it raises an exception on enumeration indicating that there is n...

LLBLGenPro - How to update database field value directly based on predicate

I have a table that has a column called Ordinal used to keep track of display order. When an entity changes its ordinal value, the other records in the database need to have their ordinal value adjusted, either up or down depending on the situation. Is there a way through llblgen to do this (2.6 adapter .net 3.5)? I would need generated...

LinqDataSource Page 1 queries for all records, pages 2-n queries by page size

I'm passing a LinqDataSource into a Telerik RadGrid. The LinqDataSource is an LLBLGen ORM. Everything is working great - paging, grouping, filtering, etc. all work nicely. I wanted to see how the SQL queries looked. I found these curious results: When I look at page 1, two queries are executed... 1 for the total record count and 1 fo...

Generating client-side validation from LLBLGen validation

I've been looking and it seems no-one has cracked this yet but I thought I'd ask the community here as well to see if anything came up. Is there a way to get client-side validation (jQuery, Live Validation, whatever) to automagically get the validation rules from LLBLGen's built in validation? LLBLGen (and others like Subsonic) alread...

LLBL: Delete Where NOT IN

I'm trying to perform the following query in LLBL and I'm not having much luck. DELETE FROM dbo.MyTable WHERE MyTableId NOT IN ('39', '43', '44') Essentially, I'm up to this point: private static void Delete(MyTableCollection newRecs) { PredicateExpression filter = new PredicateExpression(); MyTableCollection allRecords = new...

LLBLGen - TransactionScope or DataAccessAdapter.StartTransaction

I see there are two main options for managing transactions with llblgen. Method 1: using(DataAccessAdapter adapter = new DataAccessAdapter()) { adapter.StartTransaction(IsolationLevel.ReadCommitted, "TR"); try { // ... adapter.Commit(); } catch { adapter.Rollback(); throw; } ...

What is the difference between llblgen and nHibernate?

What are the key differences between llblgen and nHibernate? ...

Should one extend or encapsulate ORM objects?

I'm having trouble understanding how to use ORM generated objects. We're using LLBLGen for mapping our database model to objects. These objects we encapsulate in another layer which represents our business model(I think). Maybe this bit of code will explain this better. public class Book { // The class as used in our application pr...

Can database fields be dragged and dropped (as textboxes, not a gridview) into an ASP.Net form?

In VisualStudio, when you drag and drop a table or an individual column from a data connection in server explorer, a gridview is created. What I want to be able to do is drag and drop the columns to make a quick and dirty detail form to display an individual record. Is this possible in any way? An even better way to do this would be v...

nHibernate versus LLBLGen Pro

I am trying to work out with ORM tool to move over to and have narrowed it down to two candidates. nHibernate or LLBLGen Pro Please can you guys give me pros and cons in using both these tools especially if you have experience in both. I am not really interested in any other tools but am wanting some heads up so I can decide which too...