Story Details for articles
CondorXE Part 1 Code Generator
What is CondorXE?CondorXE (eXtended Edition) is a flexible extension to the MyGeneration Software code generating tool.
MyGeneration Software is an Open Source tool that allows you to add your own code, to generate code. It's extremely flexible and you can write code that will generate just about any type of code, from stored procedures, to PHP, to C# or VB.Net code, and more. You can find out more about it from the site. http://www.mygenerationsoftware.com.
Generally you write your code directly in the user interface of MyGeneration called a Zeus file. While this works great, I found that if I wrote a large amount of code in the Zeus file it got a little cumbersome to keep track of. I wished there was a way of using Visual Studio so I can write my code-generating classes so I could also write tests and isolate code into separate classes and modules There is a way!
I found out that MyGeneration was built with components that would allow me to write my code in Visual Studio, which opens up an entire new set of possibilities. So that's what I did.
My first few versions of Condor were written completely inside the Zeus file. Once I was able to make the move to Visual Studio, I renamed my project to CondorXE, saying that this was an eXtended Edition of the original idea.
So, what does it do?
CondorXE gives you a way of creating your own code-generating code, and then plugging your components into Condor to be executed. If you are familiar with how MyGeneration Software works, then the concept is the same. You are the author of the code that will be executed to generate the code. Only by using CondorXE, you can use Visual Studio to build the code generating code, and it really is no more work that it would be if you wrote it directly into the MyGeneration Zeus file.
CondorXE is partitioned into four main sections:
- Business Objects - domain objects, pocos, it's all the same. These are simply classes that represent your data entities. They will be used by the Data Objects and Services and the Presentation Layer.
- Data Objects - this section will contain any ORM that you may be using such as the Entity Framework, Entity Spaces, MySql, ADO.Net, or anything else that generally accesses data.
- Services - the services can be of any type. They can be a simple set of class libraries that access the Data Objects, or they can be WCF, REST services, or anything like that. It's up to you.
- Presentation Layer - this also can be any presentation UI, such as an ASP.NET MVC application, ASP.NET WebForms, WPF, HTML5, etc. You can build the code generating classes here to include as much or as little UI code as you want.
I built Condor XE to be as user friendly an intuitive as possible.
It's important to understand if you have never used MyGeneration Software before, that it does not generate code by itself. It provides a means for you to write code easily that will generate code the way you want.
This is the same principal behind CondorXE. Think of it as a Visual Studio extension on top of MyGeneration Software, meaning that you don't go through the CondorXE UI and start checking boxes and setting variables, etc, which will somehow magically generate the code you want.
You go through a few Tabs in the CondorXE UI to choose Visual Studio assemblies that you've written to generate code for a specific layer. I will explain.
Let's say you generally build web applications that have two layers, the UI (Web site) and a Data Access Layer.
Let's say your data access layer (DAL) uses ADO.NET as the data access method and the code is wrapped inside methods that are in classes based on interfaces. The interfaces can contain standard CRUD methods as well as any custom procedures you may need.
Now let's say in your website you access those DAL classes via some sort of dependency injection against the interfaces. This is perfect and it's always worked, the only problem is it's a repetitive effort to write all this code for every new application that you build. This is the perfect scenario to extract all this out to be generated.
In order to move this process to CondorXE, just follow these general steps:
- Build an application that works
- Create a new Project with components that implements CondorXE interfaces for whatever layer you are building
- Take your working code and modify it to work against any database schema and wrap it in CondorXE specific code
- Save your assemblies and copy to the MyGeneration folder
Those are the basic steps. There are really more detailed steps you need to take to modify your own code for CondorXE, but that will give you the broad strokes needed to do the job.
In a future article and screencast, I will demonstrate exactly how to build a new code-generating component from scratch based on your code.
In the next article, I'll explain how to setup and install CondorXE.