Problems Binding OA to Winforms RadGridView

5 posts, 0 answers
  1. Michael Yereniuk
    Michael Yereniuk avatar
    10 posts
    Member since:
    May 2008

    Posted 31 Aug 2010 Link to this post

    First off, I'm new to OA, so I may be missing something obvious here. Any suggestions would be apprecaited.

    Regardless, I'm trying to do a simple project -- bind the categories table from NorthWind to a RadGridView. I'm getting an error that gets thrown as the form is loading.

    Using VS 2010 (VB.net)
    RadControls for WinForms Q2 2010 SP1
    OpenAccess 2010 2 714

    Here are the steps to reproduce:

    1. Create a new Windows Application project
    2. Add a "Telerik OpenAccess Domain Model" item and link it to Northwind and the Categories table. (default options). ASIDE: I can't click on "New Connection" when defining the model; I have to provide the connection string manually.
    3. Save & Compile the project to get the Context
    4. On Form1, Add an OA ObjectProvider and link to the context & Category object
    5. On Form1, Add an OA ObjectView and link to the ObjectProvider
    6. Add a RadGridView on Form1 and set the DataSource to be the ObjectView from step 5.

    Note: At this point, the RadGridView shows the columns from the object in Design Mode.

    7. Run the app. Error gets thrown.

    Here's what I get:

    System.InvalidOperationException was unhandled
      Message=An error occurred creating the form. See Exception.InnerException for details.  The error is: ObjectProvider: Helper type has no ObjectScope method.
      Source=ORMTest2
      StackTrace:
           at RadControlsWinFormsApp1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
           at RadControlsWinFormsApp1.My.MyProject.MyForms.get_Form1()
           at RadControlsWinFormsApp1.My.MyApplication.OnCreateMainForm() in C:\Projects\ORMTest2\ORMTest2\My Project\Application.Designer.vb:line 35
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           at RadControlsWinFormsApp1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.MissingMethodException
           Message=ObjectProvider: Helper type has no ObjectScope method.
           Source=Telerik.OpenAccess.Windows
           StackTrace:
                at Telerik.OpenAccess.ObjectProvider.InitializeHelper(Boolean reset)
                at Telerik.OpenAccess.ObjectProvider.get_ObjectContext()
                at Telerik.OpenAccess.ObjectProvider.InitializeDataSource(Boolean refresh)
                at Telerik.OpenAccess.ObjectProvider.GetObjectSet()
                at Telerik.OpenAccess.ObjectProvider.get_Objects()
                at Telerik.OpenAccess.ObjectView.GetMyObjectList(Boolean firechanged)
                at Telerik.OpenAccess.ObjectView.get_Count()
                at System.Windows.Forms.ListBindingHelper.GetFirstItemByEnumerable(IEnumerable enumerable)
                at System.Windows.Forms.ListBindingHelper.GetListItemTypeByEnumerable(IEnumerable iEnumerable)
                at System.Windows.Forms.ListBindingHelper.GetListItemType(Object list)
                at Telerik.WinControls.Data.RadListSource`1.Bind(Object dataSource, String dataMember)
                at Telerik.WinControls.Data.RadListSource`1.notification_Initialized(Object sender, EventArgs e)
                at System.Windows.Forms.BindingSource.OnInitialized()
                at System.Windows.Forms.BindingSource.System.ComponentModel.ISupportInitialize.EndInit()
                at RadControlsWinFormsApp1.Form1.InitializeComponent() in C:\Projects\ORMTest2\ORMTest2\Form1.Designer.vb:line 110
                at RadControlsWinFormsApp1.Form1..ctor()
           InnerException:



    Any suggestions?
  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 02 Sep 2010 Link to this post

    Hello Michael Yereniuk,

    The ObjectView and ObjectProvider work only with the old classic wizards approach where the database interaction is handled with a scope (IObjectScope). To use the new visual designer context, you can create a binding source as the data source for the grid. The data source of the binding source in turn can be assigned a collection of persistent objects retrieved through the context.

    I am attaching an example which demonstrates not only binding but also handling edit operations for the grid. You need to subscribe to suitable events in order to manage the insert and delete logic. Such events are the ListChanged event of the binding source and the RowsChanging event of the grid. I have also included the best practices in context management as described in the knowledge base article. The example uses the NorthwindOA database which is installed on SQL Server Express by default.

    I hope that the sample will give you a general idea on how to accomplish basic tasks related to the integration of OpenAccess with other Telerik controls. Do not hesitate to contact us if you have more questions.

    Best wishes,
    Petko_I
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Michael Yereniuk
    Michael Yereniuk avatar
    10 posts
    Member since:
    May 2008

    Posted 03 Sep 2010 Link to this post

    Hi Petko_I!

    Thanks for the code sample. That helps me out tremendously!!

    Took a while to decipher the code, but I'm pretty sure I've got a handle on this now.

    Thanks again!

    Michael
  5. giuseppe
    giuseppe avatar
    10 posts
    Member since:
    Nov 2010

    Posted 10 Mar 2011 Link to this post

    Hello,

    I am trying to use the sample application you provided but I am getting this error after upgrading to the latest version of ORM

    VisualBasic.Net: There already is another constructor with the same signature EntityDiagrams.vb NorthwindLibrary 35 16 VisualBasic.Net
    VisualBasic.Net: There already is another constructor with the same signature EntityDiagrams.vb NorthwindLibrary 39 16 VisualBasic.Net
    VisualBasic.Net: There is no applicable member or variable 'backendConfiguration' EntityDiagrams.vb NorthwindLibrary 48 36 VisualBasic.Net
    VisualBasic.Net: There is no applicable member or variable 'backendConfiguration' EntityDiagrams.vb NorthwindLibrary 40 46 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 105 61 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 39 54 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 27 35 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 47 82 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 106 55 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'BackendConfiguration' EntityDiagrams.vb NorthwindLibrary 106 28 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'IObjectScope' NorthwindOAContextExtended.vb NorthwindLibrary 11 47 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'MetadataSource' EntityDiagrams.vb NorthwindLibrary 29 42 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'MetadataSource' EntityDiagrams.vb NorthwindLibrary 43 76 VisualBasic.Net
    VisualBasic.Net: Unknown entity 'MetadataSource' EntityDiagrams.vb NorthwindLibrary 47 128 VisualBasic.Net
    VisualBasic.Net: Unknown method 'Add' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' FormController.vb WinFormsApplication 49 32 VisualBasic.Net
    VisualBasic.Net: Unknown method 'Delete' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' FormController.vb WinFormsApplication 62 33 VisualBasic.Net
    VisualBasic.Net: Unknown method 'Dispose' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' FormController.vb WinFormsApplication 81 28 VisualBasic.Net
    VisualBasic.Net: Unknown method 'GetScope' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' NorthwindOAContextExtended.vb NorthwindLibrary 12 23 VisualBasic.Net
    VisualBasic.Net: Unknown method 'GetScope' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' NorthwindOAContextExtended.vb NorthwindLibrary 16 23 VisualBasic.Net
    VisualBasic.Net: Unknown method 'SaveChanges' of 'NorthwindLibrary.NorthwindOAEntityDiagrams' FormController.vb WinFormsApplication 71 28 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'backend' EntityDiagrams.vb NorthwindLibrary 32 46 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'backend' EntityDiagrams.vb NorthwindLibrary 44 36 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'backend' EntityDiagrams.vb NorthwindLibrary 36 36 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'metadataSource' EntityDiagrams.vb NorthwindLibrary 48 58 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'metadataSource' EntityDiagrams.vb NorthwindLibrary 40 68 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'metadataSource' EntityDiagrams.vb NorthwindLibrary 44 45 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'metadataSource' EntityDiagrams.vb NorthwindLibrary 36 45 VisualBasic.Net
    VisualBasic.Net: Unknown type of member 'metadataSource' EntityDiagrams.vb NorthwindLibrary 32 55 VisualBasic.Net
    VisualBasic.Net: Unknown type of variable 'backend' EntityDiagrams.vb NorthwindLibrary 108 20 VisualBasic.Net
    VisualBasic.Net: Unknown type of variable 'backend' EntityDiagrams.vb NorthwindLibrary 107 13 VisualBasic.Net
    VisualBasic.Net: Unknown type or namespace 'IObjectId' of 'Telerik.OpenAccess' OrderDetail.generated.vb NorthwindLibrary 100 39 VisualBasic.Net

    Did I miss something?

    Thanks, Giuseppe
  6. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 16 Mar 2011 Link to this post

    Hello giuseppe,

    Please, excuse us for the late reply. We were pretty busy with the preparation for the release. In order to run the example successfully you will need to upgrade the references to the OpenAccess assemblies as the example was built with a previous version of OpenAccess. In order to upgrade the references to the assemblies needed for OpenAccess you can use the upgrade option available from the context menu in the solution explorer or alternatively follow the steps in this help article. You can verify that you have the correct assembly references to Telerik.OpenAccess and Telerik.OpenAccess.35.Extensions after the upgrade.

    Do not hesitate to contact us right away, should you experience further difficulties.

    Greetings,
    Petko_I
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner