I would like to now use all the telerik tools as there really look like they can increase the speed of the development.
So i have started with creating a model using OpenAccess, i chose create data model from the menu.
So far so good. Created some domain objects, used default mapping for tables, created a script for my database executed it.
All fine.
Next step, i am trying to create a domain service. The Open Access RIA wizard pops up i chose my DataContext.
And there is nothing in it.
I just see a grey box, No list of entities to select from or anything.
What am i doing wrong?
21 Answers, 1 is accepted
That is actually a limitation of the RIA wizard itself. The default mapped tables actually does not live in the model and as such they cannot be displayed in the ria wizard. This problem has been fixed in our new version of the RIA wizard that will be shipped with our next service pack.
What you can do is add the domain service without selecting any endpoints. This will create a class that will inherit from our domain service implementation. You can than edit the tt template to add the classes you need to generate. Here is an example:
string fileName = "DomainService1";
string contextTypeName = "EntitiesModel";
string contextNamespaceName = "ConsoleApplication111";
string queriableTypesInput = "Category;Product";
string queriableClassNamesInput = "Categories;Products";
string[] queriableTypes = null;
string[] queriableClassNames = null;
string editableEndPoints = "Category";
The above example will generate endpoints for Category and Products where only the Category endpoint will be editable.
Petar
the Telerik team

I am not sure i understand what to do here. Are you saying I should first add the domain service and then add the code you showed me? What about the generated.cs file? What do I need to add there?
This might be a little bit beyond me; perhaps I should go back to Entity Framework.
:(
I am able to now create the domain service.
I don't understand why this works.
Is this indented?
What will happen if i create an additional entity?
This is very confusing, what is the difference between the two models?
The reason you were not able to work with the RIA wizard on the first place were the default mapped tables. Those tables were replaced by the ones on your server once you reverse mapped your model. The problem with the default mapped tables is that they are not real tables. They are fictitious tables showing to the user what the table would look like should he decide to create it. However until they are created they are not really there and thus the wizard is not able to use them.
My instructions from my previous post hinted that you should add the domain service even though you are not able to see the entities and then alter the tt file as per the instructions stated there.
Please do let me know if you have any further difficulties.
Petar
the Telerik team

I have tried what you described. It generated my genrated.cs file. All looks good.
However i get an error when trying to complie the solution.
"The entity 'Organisation' in DomainService 'cintDomainService' does not have a key defined. Entities exposed by DomainService operations must have at least one public property marked with the KeyAttribute. "
Any ideas why that happened?
The RIA data services use a naming convention to determine the primary key of a class. If for some reason the primary key is not discoverable you can encounter this error. The solution for this is to mark the primary key of the failing class with the [Key] attribute. Please note that this is rather RIA services limitation rather than OpenAccess one.
Greetings,Petar
the Telerik team

Do i understand you cerrectly that i need an atribute on the class in the organisation.generated.cs file?
Will this not be removed every time the EntityModel is changed?
Should not this be some sort of property one can set on the model?

using
System.ComponentModel.DataAnnotations;
private
int _id;
[
Column()]
[
Storage("_id")]
[
Key]
public virtual int Id
{
get
{
return this._id;
}
set
{
this._id = value;
}
}
I hope that is what you ment.
It compiles now, but i get an error when running the project, the error: " An error occured while loading data through the 'GetOrganisationsQuery' query."

I am still getting an unhandled exception.
This only happens when i create the model in the project then create the database from the model.
I have created another project (for testing) and had the wizard create the model from teh database, this way i don't get an error.
I also do not get an error when doing the exact same with Entity Model Wizard.
So it is a problem with Open Access.

Nothing? Really?
Am i the first person to encounter this error?
That does not seem likely.
Can you please check what is the key generator in the case when you generate your database from your model? Is it possible that you are relying on the internal primary key implementation from OpenAccess?
Kind regards,Petar
the Telerik team

Are you refering to the indentiy mechanism in the class?
You need to be a little bit more specific.

If you are referring to the identity mechanism, i have it set to DatabaseServerCalculated so that my database id is set to both key and identity.
Also, i am not sure if this really matters here, as i am not creating any actual records yet. I am far from that.
This error occurs on the "get" query.

I have now found the inner exception for hit error:
"Type is enhanced and registered, but not available from the database class meta data. This can be caused by wrong connection id or configuration."
I see from your forum that this happens when you have more than one data model in the project.
I only have one so that is not an issue here.
I would really appreciate your prompt response. I have now been trying OpenAccess for two weeks and am nowhere close to even making a small sample app that will work.
Thanks

I have now found a solution for the problem.
Unfortunately that is not a solution that can be implemented.
It is a problem with your software. When creating the model it does not generate the object file correctly.
If i add the following two lines to the generated file it will work:
[
Table("product")]
and
[
Column("product_id", OpenAccessType = OpenAccessType.Int32, IsBackendCalculated = true, IsPrimaryKey = true, SqlType = "int")]
The problem is of course that i cannot simply type that in there as it will disappear when it is regenerated.
What do you propose I do to solve this error?
Are the entities you needed to add the table and column attributes default mapped? Currently our attribute mapping is lacking the functionality to handle default mapped entities. The easiest solution would be to switch to xml mapping as there everything is fully supported. If this is not an option for you I will advice you to add metadata classes(buddy classes) and define your attributes there. This way the will not be overwritten on each code generation.
All the best,Petar
the Telerik team

I tried the matadata classes, but even when putting the
Column("product_id", OpenAccessType = OpenAccessType.Int32, IsBackendCalculated = true, IsPrimaryKey = true, SqlType = "int")]
It would not work. i had the same error.
Now i am trying to use the xml mapping, but i am not sure how to use it.
Is it different?
I changed it and recreated my DomainService.
But now get an error saying:
Unable to load the metadata for assembly...
Is there soemthign else one does when usign this kind of mapping?
Do you have an example on how to do this?

Ok, fixed that.
It appears that when trying to convert to xml the model just does not work.
I scrapped the project and tried it in a new test one. It works with XML.
I have one question.
What are the advantages and disadvantages of the two mapping types?
Apart from the obvious one works the other does not of course.
My question applies to the point when you have fixed the issue in a new release.
Thanks.
The attribute mapping is somewhat more obvious and easy to see and understand than the xml mapping. In the end they should be the same (though currently our xml mapping is better supported than the attribute mapping).
All the information you are able to see in the attributes mapping can be seen in the xml as well.
Petar
the Telerik team

I just want to note in this thread the progress that was made on the topics mentioned:
- We have been improving the Attributes mapping a lot during the last 18 months and in Q3 2012 you will find it much more mature and useful
- Using more than one model is possible in a single project, although not out of the box, as we assume in the majority of cases only one context is used for data access. You can even define two models and still access your database using only one context, as specified here. Furthermore, in the next release we are planning to deliver support for many diagrams based on one model for further flexibility and manageability of larger models.
- There are many other usability improvements shipped with the latest release.
Of course, there is still a lot we can improve and we will most certainly continue working in that direction for the future releases of OpenAccess ORM, so do not hesitate to provide any feedback you have.
Ivailo
the Telerik team