Wednesday, January 07, 2009 Register    Login
Instructions

In order to add new threads or reply to existing posts, you have to be logged-in. If you are not registered yet, you need to register first, and then login with your personal credentials.

   

CslaFactory Forums
 
  Forum  Support  CslaFactory CTP  Different db Providers
Previous Previous
 
Next Next
New Post 5/13/2008 6:52 PM
  kilroy
2 posts
No Ranking


Different db Providers 
First of all, you have done a great job here. I have tried creating some code with your CslaFactory and it will be a real time-saver!! As far as I can see, there are a few things to iron out, but this looks like exactly what I have been wanting for my prijects for a long time! Now, I know you have said somewhere here that we can write our own database providers, but I can't figure out how to do that. Will you have documentation for that? I know there are probably a lot of people out there that use many other types of databases instead of just SQL Server. I need to write code for PostgreSQL, Oracle, and MySQL. At the very least, we need to be able to map C# types to DB types other than just SQL Server... Thanks again for your efforts on this product!!! Kim Friesen
 
New Post 5/13/2008 10:19 PM
  Marcel
49 posts
No Ranking


Re: Different db Providers 

Hi Kim,

you can find the text templates that are used to generate the tables.sql and storedprocedures.sql files in the TextTemplates directory under the CslaFactory installation directory. The templates dealing with database files all start with a DB-prefix. For example, DBTables.tt, DBStoredProcedureList.tt and so on. There is currently no proper documentation, so I think it might be a good idea to blog about it or open a thread so we can discuss some aspects of customizing the CslaFactory.

With the current release (CTP) it is not possible to map C# types to DB types other than SQL Server, because the provider model wasn't finished on time. Our current development version already uses the provider model to map types during the generation process.
If you want to change the mapping (for using a different database or even using non-standard types in your model), you need to implement a specific interface (IPropertyConversionProvider). There is a GetDatabaseType(PropertyType propertyType)-method, for example, that returns the string representation for the database type of given BusinessObject's property. Having implemented this interface, you will be able to introduce your conversion provider-.dll by extending a configuration file. The generation host will discover it and use your provider on generation.

-Marcel

 
Previous Previous
 
Next Next
  Forum  Support  CslaFactory CTP  Different db Providers
   

UsersOnline
Membership Membership:
Latest New User Latest: arnaldocosta
New Today New Today: 5
New Yesterday New Yesterday: 3
User Count Overall: 724

People Online People Online:
Visitors Visitors: 7
Members Members: 1
Total Total: 8

Online Now Online Now:
01: pberggreen