6 Answers, 1 is accepted
You can create your domain model in a class library project and then from the windows forms project reference the DAL. The only thing you need to do is add references to the Telerik.OpenAccess, Telerik.OpenAccess.35.Extensions assemblies and copy the connection string in the application configuration file. From then on, you can start consuming the domain model with full power in the windows forms project. We have a quick start section in the online help that describes the steps you need to follow. Unfortunately, we do not have a windows forms example with VB.NET, however we plan to introduce one for the Q3 release. You can benefit from looking at the following examples nevertheless (most of them are web).
Should you need further information, do not hesitate to contact us right away.
Greetings,Petko_I
the Telerik team
Delete Section
C#
{
Car selectedCar = this.dataSource.Current as Car;
if ( selectedCar == null )
return;
( this.dataSource.DataSource as IList<Car> ).Remove( selectedCar );
this.dbContext.Delete( selectedCar );
}
VB
If True Then Dim selectedCar As Car = TryCast(Me.dataSource.Current, Car) If selectedCar Is Nothing Then Return End If TryCast(Me.dataSource.DataSource, IList(Of Car)).Remove(selectedCar) Me.dbContext.Delete(selectedCar) End If
AddNew Section
C#
{
Car newCar = new Car();
newCar.Make = "WV";
newCar.CarID = 100;
newCar.Model = "Golf";
( this.dataSource.DataSource as IList<Car> ).Add( newCar );
this.dbContext.Add( newCar );
}
VB
If True Then Dim newCar As New Car() newCar.Make = "WV" newCar.CarID = 100 newCar.Model = "Golf" TryCast(Me.dataSource.DataSource, IList(Of Car)).Add(newCar) Me.dbContext.Add(newCar) End If
As far as I see the conversion is correct. Can you describe what the errors or unexpected behaviors are when you follow the guide? I have prepared a sample VB example which demonstrates CRUD operations with a RadGridView. There isn’t a fully automated way to bind a collection of persistent objects directly as a data source. Usually a BindingSource acts as a mediator. Can you have a look at the example and see if it answers your questions?
I am looking forward to your reply.
Best wishes,Petko_I
the Telerik team
You said, "There isn’t a fully automated way to bind a collection of persistent objects directly as a data source."
Are there plans for one in the near future? (ie 2010 Q3)
If not when?
Doesn't not having a fully automated way kill the idea of RAD?
I can't even set the column properties to display only selected columns since the RadGridView is not directly bound to the DataSource or BindingSource
I like the Visual Designer which is a huge improvement. However it's not worth it if I have give up binding the persistent objects to controls.
This is your description of Open Access:
Transparent Persistence is therefore, the ability to directly manipulate data stored in a relational database using an object-oriented programming language, i.e., no SQL statements are needed to retrieve, insert, or update objects in the database and the tasks associated with conversion between your object model and your table model are done automatically. OpenAccess ORM is intended to be used with all managed languages, such as Visual Basic.NET, C#, J# etc. and it has very few restrictions on the data model used.
Is this statement still correct for the current version?
We have not planned adding features for windows forms automated binding with a domain model context in the near future. Actually, we do not intend to provide functionality such as the ObjectView and ObjectProvider for the domain model. Other conveniences may come into action to facilitate the usage of the domain model. If you really feel that something is necessary, you can place a feature request. All suggestions are highly welcome. At this point, we have considered that the available means to bind a collection of persistent objects to a control are flexible enough. What we might be lacking is a comprehensive example or related documentation that covers a binding scenario from scratch. We are currently working towards the expansion of our set of examples and this is high priority for the Q3 release.
The paragraph you have cited refers to adopting object-oriented tools at the appropriate level of abstraction so that the user is programming in terms of a specific domain. This means that we are trying to isolate the database specific details from the object-oriented model so that the user worries only about business rules and object-oriented development. The complete automation of the integration between a domain model and a UI control goes slightly beyond the scope of an ORM tool.
Do not hesitate to share your proposals with us. Any arguments you feel are important will be accepted and taken into consideration.
All the best,
Petko_I
the Telerik team