MsCorEE

JeffGonzalez : IScalable

January 2004 - Posts

Great article on NAnt and .net build process

This is a very good article about the aforementioned subjects by Justin Gehtland.

http://www.theserverside.net/news/thread.aspx?thread_id=23622

The last configuration section handler i'll ever write.... errr copy

Mad props to Craig Andera for this little tidbit.

http://staff.develop.com/candera/weblog2/articleview.aspx/CLR%20Workings/The%20Last%20Configuration%20Section%20Handler%20I.xml

I have recently replaced all of my section handler's with Craig's code and it is working great.

Craig's example is pretty nice, but with some help from Daniel Cazzulino, I made my objects just a tiny bit better.  With Craig's example, I could not specify properties as attributes in my Xml.  Before I was using....

<StyleSheetSettings type="CodeMakerX.Foundation.Web.Helpers.StyleSheetSettings, CodeMakerX.Foundation.Web">
        <StyleSheets>
                <StyleSheet>
                        <Name>Browser</Name>
                        <Href>/Lib/Styles/Screen.css</Href>
                        <Media>screen</Media>
                </StyleSheet>
        </StyleSheets>
</StyleSheetSettings>

By decorating my class with the <XmlAttributeAttribute> | [XmlAttribute] class, I was able to use the following Xml in my config file instead.

<StyleSheetSettings type="CodeMakerX.Foundation.Web.Helpers.StyleSheetSettings, CodeMakerX.Foundation.Web">
        <StyleSheets>
                <StyleSheet Name=“Browser“ Href=“/Lib/Styles/Screen.css“ Media=“screen“/>
        </StyleSheets>
</StyleSheetSettings>

Here is some sample code to demonstrate the above methodology.

<PersonSettings type="CodeMakerX.WebMakerX.DataAbstractionConsole.PersonSettings, CodeMakerX.WebMakerX.DataAbstractionConsole">
        <Person Name="Jeff Gonzalez"/>
</PersonSettings>

VB.NET Version
===================================
Imports
System.Xml.Serialization

Public Class Person

        Private _Name As String

        <XmlAttributeAttribute(DataType:="string", AttributeName:="Name")> _
        Public Property Name() As String
                Get
                       
Return _Name
               
End Get
               
Set(ByVal Value As String)
                        _Name = Value
               
End Set
        End Property

End
Class

C# Version
===================================

using System.Xml.Serialization

public class Person
{
        private string _name;

        [XmlAttribute(“Name“, typeof(String)]
        public string Name
        {
                get
                {
                        return name;

                }
                set
                {
                        name = value;
                }
        }

}

I put the above code inside a console app and used the following to get an instance of my deserialized Person object...

Dim _Person As Person = CType(System.Configuration.ConfigurationSettings.GetConfig("PersonSettings"),CodeMakerX.WebMakerX.DataAbstractionConsole.PersonSettings).Person
Console.WriteLine(_Person.Name)

I also created a PersonSettings class with a single Person property.

I gotta say, this will definitely save us some time when dealing with configuration files.

The fruition of my labor

http://news.moneycentral.msn.com/ticker/article.asp?Symbol=US:REY&Feed=PR&Date=20040120&ID=3298797

I guess it is public now.  For the past 5 months our team at work has been hard at work on our new application, WebMakerX 4.0.   It has been a tremendous learning experience and I have had the privilege of working with some of the smartest people I have ever met.

DBDocumenter and NGallery Rock

Damn, this thing is sweet.  I now owe Jason Alexander at least 2 beers for his work.

Check out DBDocumentor  and NGallery, they are both great.

I am currently using NGallery to run my family album with pictures of the kids, christamas, halloween, etc...

 

I just downloaded and setup DBDocumentor to run on our application database.  Wicked stuff.

Poor man's partial class

We just implemented this at work and it works great.  Explaination below...

For you code generators out there using a model like this...

Customer customer = new Customer(11);
customer.Name = “Jeff Gonzalez”
customer.Save();

I will call Customer a DataAbstraction object.  It is a representation of a table in our database.  The problem with this scenario is, what if the database changes to add a property.  If you had made any additions to the Customer class, and you regerated, your additions would be overwritten, or you would have to merge these files by hand (read: tedious).

The way we solved this problem was creating a DataAbstraction.Generated namespace.  In our code generation process, we output 2 files (Customer.cs, and Customer_Generated.cs).  The Customer class now inherits from the Customer_Generated class.  This way we can run the generated stuff any time we want, and we can put our additional logic inside the Customer class without having the maintenance problems.

We called this “Poor man's partial classes“ =)

Implementing and Managing a build process

I have been tasked with the implementation and creation of a build process here at work.  I have read Microsoft's guide on creating one, but it left me with a few questions.  I am beginning to wonder if I am using source control correctly.

We currently use CVSNT and TortoiseCVS for our source control solution.  It is free (open source) and very nice.  We do not have a build process or build management system in place at all right now.  One thing I have seen a lot of, is daily integration builds.

As of right now, we have 5 foundation projects for stuff like DataAccess, EntityFramework, ExceptionManagement, Utilities, and Web Controls.  Each of those projects is shared across our applications.  We currently have 3 applications(read: user interfaces) being built around 1 central database.  We have a consumer facing application, a dealer(read: automotive dealerships) application and an administrative application.  The consumer/dealer applications deal with managing the content of the database, while the admin application deals with addition of things like security, inventory, forms management, etc...

We have architected our system in such a way, that all 3 applications share the same DataAbstraction or Entity objects.  We also have a Business project that abstracts the DataAbstraction(bear with me) even further.

I suppose my question(s) is, how do most developer's with an integrated build process manage all of this. 

Should all of the developer's be running NAnt or something similar on their local machines to build and compile the projects as they work? 
Do the foundation and shared projects get built nightly, and their resulting assemblies shared?
Do I check everything out from source control, build it, then check it back in?

If anyone has thoughts or can offer pointers, they would be greatly appreciated.

More Posts