Hopefully this guide will be useful to those who use free tools to develop websites using dOOdads, SharpDevelop and ASP.NET. This is targetted at SQL Server (as I don't have access to the other database systems supported by dOOdads). I would appreciate any feedback on this (either here, or via http://www.mygenerationsoftware.com/phpBB2/viewtopic.php?t=1780).
Note that SharpDevelop can’t be used to develop ASP.NET pages (or at least it is no better than a text editor in editing them), but can be used for the code behind and support libraries. Download it from:
First of all, copy the folder C:\Program Files\MyGeneration\Architectures\dOOdads\CSharp\MyGeneration.dOOdads to another location. (e.g. C:\Projects)
Open SharpDevelop. Create a new Combine (equivalent of VS Solution) called MyWebsite (or whatever you prefer) in a location of your choice (e.g. C:\Projects\MyWebsite). Right click the project and Add > New Folder. Call it Database.
Right click Combine (in Projects Window). Add > Add Existing Project. Browse to folder you saved MyGeneration.dOOdads to (C:\Projects\MyGeneration.dOOdads) and select MyGeneration.dOOdads.prjx.
Select References under your project (e.g. MyWebsite). Right click > Add Reference. Select Projects tab. Highlight MyGeneration.dOOdads and click Select. Click OK.
In Projects Window, expand MyGeneration.dOOdads/DbAdapters. Right click on appropriate files for your DBMS (for SQL server, SqlClientDynamicQuery.cs and SqlClientEntity.cs) and make sure Include > Compile is checked.
Now to generate the code for accessing the database. Open MyGeneration. Make sure your Default Settings (under Edit menu) are set appropriately. Set Driver to Microsoft SQL Server and set an appropriate connection string (using the OLEDB button is probably easier than typing in the string). Set Language to C# and DBTarget to SqlClient.
Create a new project (File > New > Project). Call it the same as before (e.g. MyWebsite).
Right click New Project and click Edit. Give it a meaningful name and description and click OK. Right click it, click Add New Template Instance. Give it the name Business Entities. Select dOOdads.C#.dOOdads.Business Entity. Click Record Template Input.
Change output path to a sub directory called Database in you SharpDevelop project folder (C:\Projects\MyWebsite\Database). Give it an appropriate Namespace (e.g. MyWebsite.Database). Select your database and the tables you wish to have access to. Check Prefix the ‘File’ with an underscore. Then click OK and OK again.
Add a new template instance to the project. Call it Concrete Classes. Select dOOdads.C#.dOOdads.Concrete Class. Click Record Template Input. Choose the same settings as before (there are no checkboxes on this form like on the other). Then click OK and OK again.
Create another template instance, this time calling it SQL Scripts. Select Microsoft SQL Server.dOOdad Stored Procedures. Click Record Template Input. Change output path to a sub directory called Database\SQLScripts in you SharpDevelop project folder (C:\Projects\MyWebsite\Database\SQLScripts). Select your database and tables, click OK and OK again.
Save your project (or save as if you want to store it somewhere else). Select your project and click the green arrow to generate the code.
Open your project (if not still open). Select MyWebsite\Database in SharpDevelop. Right click it and Add > Add Files. Select all the files in the Database sub directory of your project (e.g. C:\Projects\MyWebsite\Database)
Select MyWebsite in projects list. In the properties window (or the dropdown at the top) make sure Release is selected as the active configuration. Click Project Options. Select Configurations > Release > Output. Make sure compile target is Library and set output target to your websites bin directory (e.g. C:\InetPub\MyWebsite\bin). Repeat the process for the MyGeneration.dOOdads project.
Click Build > Build Combine to generate the assembly files.
Open Query Analyzer. Click File > Open. Browse to the Database\SQLScripts sub directory of your project (e.g. C:\Projects\MyWebsite\Database\SQLScripts) and select MicrosoftSQL_ALL.SQL. Run the query.
You should now be able do use dOOdads on your website; by importing MyWebsite.Database in your code behind and instantiating the concrete classes (sample code is available on the MyGeneration website). Also remember to add the connection string to your web.config (under <appSettings>) and set the permissions as appropriate for the user account used in the connection string (EXECUTE access for all the generated stored procedures and SELECT access on the tables):
<add key="dbConnection" value="Persist Security Info=False;Data Source=servername;Initial Catalog=databasename;User ID=user;Password=pass"/>
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="MyWebSite.Database" %>
<%@ Import Namespace="MyGeneration.dOOdads" %>
private void Page_Load(object sender, EventArgs e)
Employees emps = new Employees();
rptEmployees.DataSource = emps.DefaultView;
<asp:Repeater ID="rptEmployees" runat="server">
<li><asp:HyperLink runat="server" Text='<%# DataBinder.Eval(Container.DataItem, Employees.ColumnNames.LastName) %>'
NavigateUrl='<%# "details.aspx?EmployeeID=" + DataBinder.Eval(Container.DataItem, Employees.ColumnNames.EmployeeID) %>' /></li>