Update to LINQ to SQL Business Object Wrapper Sample
Last night I after I posted the LINQ DataContext post I realized that I hadn't ever updated the LINQ Business Object Layer example app for .NET 3.5 RTM. Although I've long updated the code, since I use it here in a few internal applications as a base business object wrapper around LINQ to SQL, I hadn't updated the live examples since DevConnections last year. Ooops. This is what happens when I have too much code floating around online - I forget what's up to date and what isn't...
To recap the download includes a small ASP.NET 3.5 Time Tracking sample application which is built around this wwBusinessObject implementation. The TimeTrakker project includes a separate and reusable business object framework project which includes the business object base, an extended DataContext that also provides raw ADO.NET access so DataContext can act as a mini DAL even outside of LINQ based entity queries. I know this kind of sounds like blasphemy but it's come in handy in a few situations (serialization problems with LINQ Entities - able to pass a DataTable for example, or running queries that are way more complex to code with LINQ that as a raw SQL query) as well as taking LINQ queries and grabbing Command objects from them for manual command execution (which is a pretty cool feature of L2S actually).The DataContextFactory I mentioned yesterday also is part of this library.
No rocket science here, but I've been using this light framework in a couple of internal projects here and it's working out really well for me. There might be some useful ideas for others to check out and play wiht.
You can find out more about what's in the Business Object Wrapper from the original post. Note the post's code is Beta 2 so there are a few changes required, but the code in the download is up to date:
A simple Business Object Wrapper for LINQ to SQL
Download:
Simple Business Object Wrapper Source and Sample Application
Hope this is useful to some of you.
The Voices of Reason
# re: Update to LINQ to SQL Business Object Wrapper Sample
I am getting this error "The type or namespace name 'TimeTrakkerBaseForm' could not be found", but this class is available in folder "Classes" , please help me in this
Thanks,
Nagarajan.
# re: Update to LINQ to SQL Business Object Wrapper Sample
# re: Update to LINQ to SQL Business Object Wrapper Sample
Thanks very much for the update! Judging by the original posting, your framework looks great and I'm probably going to use it in my next project.
Thanks again,
Adrian
# re: Update to LINQ to SQL Business Object Wrapper Sample
The framework looks great..!
Do you have the DB Schema for the sample you created for download.
Thanks..Sudheer
# re: Update to LINQ to SQL Business Object Wrapper Sample
-LV
# re: Update to LINQ to SQL Business Object Wrapper Sample
It's also been rolled into the (still under construction) West Wind Web Toolkit:
http://www.west-wind.com/WestwindWebToolkit/
for easier access to changes and fixes in the code repository.
# re: Update to LINQ to SQL Business Object Wrapper Sample
ProductsBindingSource.DataSource = From pb In DC.Products Order By P.Name
Then do some editing on the products in the grid, add a few new products to the grid, then call DC.SubmitChanges and be good to go. Now if I want to use the business object wrapper for the Product entity, is it possible to bind a collection of the BO wrappers to a grid and have it act similarly to the above example?
Thanks man. This framework is VERY cool.
Monty
PS - I've ported the framework to VB.Net. Mind if I post the translation on my (as yet non-extant) blog? Giving full credit and links, of course.
# re: Update to LINQ to SQL Business Object Wrapper Sample
re: Porting. As long as you provide a link back and credit that's Ok by me. You can post the link here.
# re: Update to LINQ to SQL Business Object Wrapper Sample
http://borrell.parivedasolutions.com/2008/02/linq-to-sql-updating-in-aspnet-right.html
Thanks