By Duane Pekse on
9/6/2007 6:47 AM
Ok, after a brief hiatus over the summer where time to blog just didn't seem to exist, I figure it's time to get back to it.
So, for the last week or so I've been converting some custom controls that I originally wrote in VB.NET into C#, since our client has decided to switch their standard. This isn't terribly difficult, mostly just tedious, which makes it all the more frustrating when the 3 lines of code that were working in the VB version don't work in the C#, for no apparent reason. Once I finally figured it out, all I can say is that it would have been a lot easier if the debugger would have broke on the line that actually threw the error, instead of on the next line...
So, here is the VB code. This code is trying to find the name of an object used to track transactions in a DAL generated using LLBL Gen Pro, but the actual name of the DAL is not known at compile time, so it uses reflection to find the correct assembly and load ...
Read More »
|
By Duane Pekse on
9/5/2007 2:04 PM
For those of you who don't use LLBL Gen Pro, it generates Entity objects for you, one for each of the tables in your database. You can have it do more then that, but it can do that much simply by reverse engineering your database. It also creates strongly typed collections for each of these entities.
On the surface the collections work about as you expect. You can get any of the elements in the collection by index, you can iterate over them using For/Each, you can Add and Remove entities, you can load them using a filter, etc. They add another nifty feature not normally found on collections, and that is a .Sort method.
It isn't terribly well documented that access to the collection is actually granted through a DefaultView property on the collection, you don't have direct access to the collection. LLBL creates views th ...
Read More »
|
By Duane Pekse on
9/5/2007 1:58 PM
The application I've been working on for the past couple of months has a very generic UI on it. It uses a database table which configures which tables a user can see, how they see them, and what data they contain. This is all based on the entities that are available to the system through the LLBL generated data layer. Basically anything in the DAL can be configured, and anything that is configured can be modified by the user.
The UI literally consists of 1 form and 2 web controls, which configure themselves to suit whatever entity we are working with at the time. While this is all working fairly well at this point, some of the code that we needed was a little different. We are using reflection in lots of places to access properties on objects because we can't tell at design time which type of object we will be working with. LLBL defines a bunch of interface ...
Read More »
|
By Duane Pekse on
9/5/2007 1:55 PM
For the last few days I’ve been adding validators to my DAL for the project I’ve been working on. This project is again using the LLBL Gen Pro generated datalayer. Last time I had the validators working so they would catch my custom validation errors and throw them to the application as exceptions. Today I had to setup something to catch these errors and display them to the screen.
Of course, as always, things are never as simple as they first appear. One of the things that's changed in the most recent releases of LLBL Gen Pro is that they have implemented IDataErrorInfo on the entities, which is a standard interface provided in the System.ComponentModel namespace. ...
Read More »
|
By Duane Pekse on
9/5/2007 1:54 PM
For the last few days I’ve been adding validators to my DAL for the project I’ve been working on. This project is again using the LLBL Gen Pro generated datalayer.
So the validators are actually really easy to build. I want my business rules separated from the DAL, so I create a validator by inheriting from the LLBL ValidatorBase class, override the ValidateFieldValue method, check if the new value for the field is going to be “” and return false if it is, and then attach an instance of the validator to the entity when the entity is created. Presto, like magic the method fires when I try to assign a blank string to the field, the error message for that field gets set, and the SetNewValue method returns false saying it didn’t set the value.
Here’s where things start to fall apart…< ...
Read More »
|
By Duane Pekse on
9/5/2007 1:51 PM
The current client I am working with is using the LLBLGen Pro code generator by Solutions Design, and it rocks! After seeing this product in action I'm not sure why everyone isn't using it. If you are not you really owe it to yourself to check out the demo. (Thanks Robbie for showing me the light)
So far I have started one new application using LLBLGen, one of the other developers has started a new application using it, and we just finished converting an existing app from using datasets to using a generated DAL. I'd estimate that we removed 60-75% of the code that was in the application while we were converting it. Whole subroutines were nuked because they were no longer needed. Plus we got to redesign and improve the front end since it was so much easier to find related entities and use them, so even the business users are going to be impressed with the c ...
Read More »
|