SQL Compact Code Generator

More than a year ago, I published a project on CodePlex called SQL Compact Code Generator. Unfortunately, I never managed to find the time to do some work on it and the project was set on a very long hold. A year after I suddenly really needed such a tool and decided that I should put in some hours on the project.

I’m currently working on a large enterprise project where changes to the database schema is done rather frequently, to avoid the pain of updating my data layer after every change I decided to use my code generator.

Here’s some details I pulled directly off the CodePlex site.

Project Description
Contains a stand alone GUI application and a Visual Studio Custom Tool for automatically generating a .NET data access layer code for objects in a SQL Server Compact Edition database.


  • Visual Studio 2008 and 2010 Custom Tool Support
  • Creates entity classes for each table in the database
  • Generates data access code that implements the Repository Pattern
  • Generates methods for Create, Read, Update and Delete operations
  • Generates SelectBy and DeleteBy methods for every column in every table
  • Generates a Purge method for every table to delete all records
  • Generates Count() method for retrieving the number of records in each table
  • Generates CreateDatabase() method for re-creating the database
  • Generates xml-doc code comments for entities and data access methods
  • Generates Entity Unit Tests
  • Generates Data Access Unit Tests
  • Generates .NET Compact and Full Framework compatible code
  • Support for SQL Compact Edition version 4.0
  • Multiple test framework code generation (MSTest, NUnit, xUnit)
  • Transaction support per DataRepository instance (Begin, Commit, Rollback)
  • Code generation options to enable/disable unit test code generation
  • Windows Phone 7 “Mango” support for generating a LINQ to SQL DataContext
Coming Soon:
  • Generate database maintenance code (clear database, shrink/compress database)
  • Support for multiple versions of SQL Server Compact Edition
  • VB.NET Code Support
  • Visual Studio Add-in


NEW: Custom Tool for Windows Phone 7 “Mango”

Custom Tool

Generating Entity Classes

Generating Data Access methods that implement the Repository Pattern

Generating Entity Unit Tests

Generating Data Access Unit Tests to validate the integrity between the data layer and the actual database

Check it out! You might find it useful too…

Pocket News – Newsgroup reader for Windows Mobile

A few of you who know me probably have seen me from the Mobility community, MSDN Forums or the Newsgroups. I love helping out in the Newsgroups, I had so much fun doing so that I needed an application where I can do so while I’m on the go. Being the nerd that I am, my first reaction to this was that I needed to write a mobile newsgroup reader. I actually did before ever checking that a few of them already existed! Oh well, it was fun to write. I used the application a lot, especially while waiting in the airport, or for the train, or wherever that time feels like it stopped.

I decided to share this application to the public and publish it on CodePlex. If you’re interested in the source code or if you want to contribute to the project then check it out at http://pocketnews.codeplex.com.

Unfortunately the application misses some basic features that any messaging application should have like a drafts folder. Maybe some day I can pull myself together to finish it up, or maybe some one out there who loves the Newsgroups just as much as I do would want to contribute some time and code 🙂

SQLCE Code Generator

Some time ago, I started a hobby project for generating data access layer code for SQL Compact Edition databases. I managed to get as far as creating a custom tool and generating a code behind data access layer file (currently only in C#) for every table in the database.

I’m having a bit of a hard time finding the time to work on the project so I published it on CodePlex. If you’re interested in the source code or if you want to contribute to the project then check it out at http://sqlcecodegen.codeplex.com/

Scroll to top