Print Page | Close Window

Cabana App with a different database schema

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=605
Printed Date: 03-May-2025 at 12:39pm


Topic: Cabana App with a different database schema
Posted By: gussabina
Subject: Cabana App with a different database schema
Date Posted: 11-Dec-2007 at 10:32pm

Hi:

I tried to create a new Cabana App using my own database...The solution does not compile, as there is some code that expect certain classes (AuditableEntity) and some tables (SecurityUser, AuditValue, etc).

Do I have to create all these, in order to have an application running? 

Regards;

Gus




Replies:
Posted By: Bill Jensen
Date Posted: 14-Dec-2007 at 4:53pm

The application wizard creates a sample model project based on the IdeaBlade tutorial database, but place in a namespace you specify (default is <company>.<app>.Model.  This project also contains some common files that need to be present in any Cabana model.  Our intention is that you would remove the tutorial-specific entities from this project and replace them with your own data model.  This is a little tricky but here are some beginning steps:

  1. In your application solution, start the IdeaBlade object mapper.  Verify that it connects properly to the tutorial database.
    1. Select all a classes EXCEPT BaseEntity and User.
    2. Click delete (the red minus button) and confirm.
    3. Save the model and exit the object mapper 
  2. In the Model project:
    1. Delete or exclude TitleOfCourtesy.cs.
    2. Delete or exclude AuditArgs.cs, AuditConfig.cs, and AuditConfigService.cs (in the Common folder)
    3. Edit MainPm.cs and delete these two lines in the Initialize() method:

msManager.DefaultSaveOptions.ExcludeFromPostSaveRefetch =

new List<Type>(new Type[] { typeof(AuditValue) });

  1. Edit Source\Foundation\Services\ListConverterService.cs:
    1. In the method CreateServiceItemCore() comment or remove all cases except default.
    2. Comment or remove all five regions below this method. 
  2.  Again start the object mapper.
    1. Change the data source to point to your application database.
    2. Add classes to map to your database tables, adjust properties as necessary.  Be sure to map your “User” table that will be used to authenticate or authorize users.
    3. Save the model and exit the object mapper. 
  3. In your  model project, Edit your “User” entity:
    1. Provide an object (might be the “User” entity itself) that implements IUser.
    2. Provide static methods GetUserByCredential() and GetUserByUserLogin() that return an instance of your IUser object.  The SecurityUser.cs file from the sample model (still around but excluded from the project) provides an example.

  1. In your model project, edit LoginManager.cs:
    1. In the two methods GetUserPasswordIdentity and GetWindowsIdentity(), invoke the appropriate GetUserBy… methods on your “User” entity.

These steps may not be complete, but this should get you pretty close to being able to build and run with your model.  Obviously, we have some restructuring work to do in the next version of Cabana.

I’ll be happy to help you through this process.

Hope this helps.
 
BIll Jensen
IdeaBlade



Print Page | Close Window