Click here to Skip to main content
15,891,184 members
Articles / Programming Languages / C#

Dynamically Generate C# Data Access Code for Microsoft SQL and Other Databases

Rate me:
Please Sign up or sign in to vote.
3.45/5 (13 votes)
19 Dec 2008CDDL3 min read 76.6K   1.5K   76  
With this tool, dynamically generate C# data layer code (CRUD functions) for Microsoft SQL and other databases
This folder contains an example of using the IDataMemberNameFormatter interface to build your own data member formatter.

The purpose of a data member formatter is to format the "structure" of a data member in a class.  Different
entities have different style guides.  Since it's impossible to predict all of the possible ways the styles might
be applied, the IDataMemberNameFormatter interface gives users the ability to use their own.

It's really very straight forward to use.   Derive a class from 
MattRaffelNetCode.Apps.SqlCodeGen.InterfacesIDataMemberNameFormatter as defined in the SqlCodeGenSupport.dll 
assembly.  By implementing MakeDataMemberName you have a formatter ready.

You will need to update SQLCODEGEN.CONFIG file to know to use your formatter.  In this folder is an example
of an updated SQLCODEGEN.CONFIG file to use the sample formatter provided.  You also need to copy your assembly,
containing your class derived from InterfacesIDataMemberNameFormatter into the folder containing the program.

If you wish to use the sample provided, simply copy AlternateMemberFormatter.dll into the SQLCODEGEN.EXE folder, update 
the config file (or copy the existing one).  I think that works ;)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Architect
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions