Can't use any database other that Northwind?

I'm having issues with Jasper. I'm just testing it out using VB Express Orcas.

I've had lots of success using the Northwind Database but as soon as I try to use any other database I have issues. Either nothing will show up in any of the controls or I will get some sort of "schema not valid" error.

This is my app.config

Code Snippet
<?

<?xmlversion="1.0"encoding="utf-8" ?>

<configuration>

<connectionStrings>

<addname="testdb"connectionString="Provider='System.Data.SqlClient';Provider Connection String='Data Source=.\SQLExpress;Initial Catalog=testdb;Integrated Security=True;';Generate Default EDM=True;"providerName="System.Data.EntityClient"/>

</connectionStrings>

</configuration>

Then I used the following code in the code behind the form:

Code Snippet

Imports Microsoft.Jasper

PublicClass Form1

Dim connectionStringAsString

Dim contextAs DynamicContext

Dim binderAs AutoBinder

PrivateSub Form1_Load(ByVal senderAs System.Object,ByVal eAsSystem.EventArgs)HandlesMyBase.Load

connectionString = Configuration.ConfigurationManager.ConnectionStrings("testdb").ConnectionString

context = DynamicContext.CreateDynamicContext(connectionString)

binder =New AutoBinder(context,Me)

EndSub

EndClass

I placed a DataGridView on the form and called it "stuff" to correspond with the table "stuff" in testdb and got nothing. I even tried the bindingSource and bindingNavigator with text boxes. The result is a recordset with no records even though there are three records in the table.

Is there something that I am missing?

Cheers,

Jason Lepack

PS: Watch for the wrapping on the code snippets...

[5547 byte] By [JasonLepack] at [2008-2-15]
# 1

Hi Jason,

Jasper does work with databases other than Northwind, but you could be running into an issue with the default choices Jasper makes for class and collection names. Tyipcally these rules apply:

1. Take the database table name.

2. Make the name plural, this is the "EntitySet" collection which can be seen as a Query property on the DynamicContext.

3. Make the EntitySet name singular, this is what the class name will be.

4. Column names are added directly as property names to the class (with some formatting to capitalize the first letter).

So if your database table is named "stuff", then you will get a DynamicContext with a property "Stuffs" on it, and a type named "Stuff". The AutoBinder binds different items from Jasper to different types of controls. For example:

1. DataGrid or DataGridView can be bound to a named collection on the DynamicContext. This means you would name the control "Stuffs" in your application.

2. DropDownList or ListBox can also be bound to a named collection on the DynamicContext (Stuffs).

3. Non-"collection" controls such as TextBox, CheckBox, or DataTimePicker can be bound to a single property on a type. For example, if there is a "StuffName" property on the "Stuff" class you can name the TextBox "StuffName".

I will add a work item to our next Jasper CTP to make this easier, and for the controls to accomodate additional rules.

Jeff Derstadt - MSFT

JeffDerstadt-MSFT at 2007-9-25 > top of Msdn Tech,Incubation Technologies,Project Codename: Jasper...
# 2

Additionally you can use the Naming Service to modify the names of types, collections, or properties if your database names are fixed. I'll put some sample code together and post back shortly.

Jeff

JeffDerstadt-MSFT at 2007-9-25 > top of Msdn Tech,Incubation Technologies,Project Codename: Jasper...
# 3

That is very helpful!

I didn't realize about the pluralization or the case sensitivity.

I will continue to wait for your post about the Naming Service.

Cheers,

Jason Lepack

JasonLepack at 2007-9-25 > top of Msdn Tech,Incubation Technologies,Project Codename: Jasper...