This is a migrated thread and some comments may be shown as answers.

Create an OpenAccessLinqDataSource dynamically

1 Answer 57 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Les
Top achievements
Rank 1
Les asked on 24 Jul 2012, 07:11 AM

In C# I would like to create an OpenAccessLinqDataSource dynamically in the code behind during a page load. I then will add it to the Radgrid's datasource.
I have the the Domains set up in a Entities Diagram.
I have not seen any examples of doing this...Should the following work?

                Telerik.OpenAccess.Web.OpenAccessLinqDataSource ds = new Telerik.OpenAccess.Web.OpenAccessLinqDataSource();
                ds.ContextTypeName = "Appname.EntitiesModelxxx";
                ds.EntityTypeName = "TestName";
                ds.ID = "dsTestDatasource";
                ds.EnableDelete = true;
                ds.EnableUpdate = true;
                ds.EnableInsert = true;
                RadGrid1.DataSourceID = "";
                RadGrid1.DataSource = ds;

1 Answer, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 25 Jul 2012, 03:27 PM
Hi Les,

 Code like this should definitely work in your application. We are actually using similar code in order to write unit-tests against our datasource with the MsTest framework.

Greetings,
Zoran
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Tags
Development (API, general questions)
Asked by
Les
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Share this question
or