locked
From EntityDataSource to DomainDataSource in DD RRS feed

  • Question

  • User1432255915 posted

    Hi,

    For some reason there is no ManyToMany.ascx or ManyToMany_Edit.ascx controls when using the default asp.NET DD DomainService template.

    I am trying to change the ManyToMany.ascx and ManyToMany_Edit.ascx controls from the normal Entity Framework DD template to be able to use with DomainDataSource but am having problems. Please could someone shed some light?

    These are the problems I am having:

    1 - It works for EntityDataSource

    // Register for the DataSource's updating event
    EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

    It doesn't work for DomainDataSource

    DomainDataSource ds = (DomainDataSource )this.FindDataSourceControl();

    How do I get the DomainDataSource from within the ascx control?

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    2 - It works for EntityDataSource

     // Get the collection of territories for this employee
        RelatedEnd entityCollection = (RelatedEnd)Column.EntityTypeProperty.GetValue(e.Entity, null);

    DomainDataSource doesn't seem to have an e.Entity property or a e.Context

    How do I get the higlighted code below extracted from ManyToMay_Edit.ascx to work with Domain Service  DomainDataSource 

    ascx EntityDataSource  Code
    -----------------------------------

    public void Page_Load(object sender, EventArgs e)
    {
                // Register for the DataSource's updating event
                EntityDataSource ds = (EntityDataSource)this.FindDataSourceControl();

                // This field template is used both for Editing and Inserting
                ds.Updating += new EventHandler<EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
                ds.Inserting += new EventHandler<EntityDataSourceChangingEventArgs>(DataSource_UpdatingOrInserting);
    }

    void DataSource_UpdatingOrInserting(object sender, EntityDataSourceChangingEventArgs e)
    {
                MetaTable childTable = ChildrenColumn.ChildTable;

                // Comments assume employee/territory for illustration, but the code is generic

                // Get the collection of territories for this employee
                RelatedEnd entityCollection = (RelatedEnd)Column.EntityTypeProperty.GetValue(e.Entity, null);

                // In Edit mode, make sure it's loaded (doesn't make sense in Insert mode)
                if (Mode == DataBoundControlMode.Edit && !entityCollection.IsLoaded)
                {
                    entityCollection.Load();
                }

                // Get an IList from it (i.e. the list of territories for the current employee)
                // REVIEW: we should be using EntityCollection directly, but EF doesn't have a
                // non generic type for it. They will add this in vnext
                IList entityList = ((IListSource)entityCollection).GetList();

                // Go through all the territories (not just those for this employee)
                foreach (object childEntity in childTable.GetQuery(e.Context))
                {

                    // Check if the employee currently has this territory
                    bool isCurrentlyInList = entityList.Contains(childEntity);

                    // Find the checkbox for this territory, which gives us the new state
                    string pkString = childTable.GetPrimaryKeyString(childEntity);
                    ListItem listItem = CheckBoxList1.Items.FindByValue(pkString);
                    if (listItem == null)
                        continue;

                    // If the states differs, make the appropriate add/remove change
                    if (listItem.Selected)
                    {
                        if (!isCurrentlyInList)
                            entityList.Add(childEntity);
                    }
                    else
                    {
                        if (isCurrentlyInList)
                            entityList.Remove(childEntity);
                    }
                }
    }

    Cheers

    C

     

    Friday, February 24, 2012 10:38 AM

Answers

  • User-330204900 posted

    Hi Pallone, take this offline and e-mail me Monday and I will see what I can do for you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 26, 2012 8:04 PM

All replies

  • User-330204900 posted

    Hi Pallone, the M:M field template does not work out of the box with DS if you search for ManyToMany_Edit.ascx in this forum you will find several threads one of those does have a solution.

    Friday, February 24, 2012 12:52 PM
  • User1432255915 posted

    Hi Steve,

    I will try to search for it.

    Thanks

    C

    Friday, February 24, 2012 1:22 PM
  • User1432255915 posted

    Hi Steve,

    I have searched for ManyToMany_Edit.ascx as you suggested and read all posts but none of them have a solution to my problem.

    Could you please suggest where else I can find this solution?

    Cheers

    Friday, February 24, 2012 1:35 PM
  • User1432255915 posted

    Hi,

    Does anyone know a solution to the problem above?

    Cheers

    C

    Friday, February 24, 2012 6:11 PM
  • User-330204900 posted

    Hi Pallone, I have searched the forum and I cannot find the thread that help the M:M field template for DS sorry.

    Saturday, February 25, 2012 7:33 AM
  • User1432255915 posted

    Hi Steve,

    Thanks. I searched as well but could not find it.

    I have a couple of questions.

    1 - From the ascx control that I created, how do I get the DomainDataSource in the parent Edit.aspx page? The code I tried using FindDataSourceControl does not work. I need to set a variable to the instance that is in the Detail.aspx page so that I can further compose the query, I think.

    DomainDataSource ds = (DomainDataSource )this.FindDataSourceControl();

    2 - Since the code in the Edit.aspx is generic, how do I detect there if I am dealing with this ManyToMay_Edit.asxc control I am creating?

    Cheers

    C

    Saturday, February 25, 2012 8:13 AM
  • User-330204900 posted

    Try my FindControlRecursive extension method here:

    /// <summary>
    /// Get the control by searching recursively for it.
    /// </summary>
    /// <param name="Root">The control to start the search at.</param>
    /// <param name="Id">The ID of the control to find</param>
    /// <returns>The control the was found or NULL if not found</returns>
    public static Control FindControlRecursive(this Control Root, string Id)
    {
        if (Root.ID == Id)
            return Root;
    
        foreach (Control Ctl in Root.Controls)
        {
            Control FoundCtl = FindControlRecursive(Ctl, Id);
    
            if (FoundCtl != null)
                return FoundCtl;
        }
        return null;
    }
    
    /// <summary>
    /// Finds the control recursive.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="root">The root.</param>
    /// <returns></returns>
    public static T FindControlRecursive<T>(this Control root) where T : Control
    {
        var control = root as T;
        if (control != null)
            return control;
    
        foreach (Control Ctl in root.Controls)
        {
            T FoundCtl = Ctl.FindControlRecursive<T>();
    
            if (FoundCtl != null)
                return FoundCtl;
        }
        return null;
    }
    
    /// <summary>
    /// Finds the control recursive.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="root">The root.</param>
    /// <param name="Id">The id.</param>
    /// <returns></returns>
    public static T FindControlRecursive<T>(this Control root, string Id) where T : Control
    {
        var control = root as T;
        if (control != null && root.ID == Id)
            return control;
    
        foreach (Control Ctl in root.Controls)
        {
            T FoundCtl = Ctl.FindControlRecursive<T>(Id);
    
            if (FoundCtl != null)
                return FoundCtl;
        }
        return null;
    }
    
    /// <summary>
    /// Get the Data Control containing the FiledTemplate
    /// usually a DetailsView or FormView
    /// </summary>
    /// <param name="control">
    /// Use the current field template as a starting point
    /// </param>
    /// <returns>
    /// A FilterRepeater the control that 
    /// contains the current control
    /// </returns>
    public static T GetContainerControl<T>(this Control control) where T : Control
    {
        var parentControl = control.Parent;
        while (parentControl != null)
        {
            var p = parentControl as T;
            if (p != null)
                return p;
            else
                parentControl = parentControl.Parent;
        }
        return null;
    }
    
    /// <summary>
    /// Gets the parent control of type T.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="control">The control.</param>
    /// <returns></returns>
    public static T GetParent<T>(this Control control) where T : Control
    {
        var parentControl = control.Parent;
        while (parentControl != null)
        {
            var currentParentControl = parentControl as T;
            if (currentParentControl != null)
                return currentParentControl;
            else
                parentControl = parentControl.Parent;
        }
        return null;
    }

    This is a set of extension methods I use all the time

     

    Saturday, February 25, 2012 1:22 PM
  • User1432255915 posted

    Hi Steve,

    Thanks for the code. I will try to use it.

    Do you also have any ideas of how to detect in the Edit.aspx when I am dealing with the ManyToMany_edit.ascx control I am creating?

    I was wondering if I could extend the query in the Query Extender there. For example in Edit.aspx:

    protected void CustExpr_Querying(object sender, CustomExpressionEventArgs e)
    {
          if(ManyToMany.asxc)
         {
                e.Query = e.Query.Cast<tblWorkGroup>().Where(
                                   wg => wg.CompanieID == DropDwonList.SeldctedValue);

          }

    }

    Cheers

    C

    Saturday, February 25, 2012 7:51 PM
  • User3866881 posted

    Hello pallone:)

    Hard to do that。I think you'd better use this statament for a general way——because One-To-Many is a kind of Many-To-Many。

    Reguards!

    Saturday, February 25, 2012 7:58 PM
  • User1432255915 posted

    Sorry Decker,

    I did not understand your message?

    Is it possible to detect in Edit.aspx if my current query is related to the ManyToMany.ascx control?

    Cheers

    C

    Saturday, February 25, 2012 8:08 PM
  • User3866881 posted

    Is it possible to detect in Edit.aspx if my current query is related to the ManyToMany.ascx control?

    No,I don't think you can check with an ascx control。

    Sunday, February 26, 2012 3:11 AM
  • User-330204900 posted

    Hi Pallone, you just don't know it's all done at the field template level, what do you want to achive with the QueryExtender?

    Sunday, February 26, 2012 5:40 AM
  • User1432255915 posted

    Hi Steve,


    I would like to hook to the QueryExtender's query (maybe using a Customer Expression) that is located in the Edit.aspx so that I can further compose the query before sending it to the database to get the list of WorkGroups that belong to the selected company and select the WorkGroups that the user belongs too in edit mode.

    In insert mode I do not need to have any of the WorkGroups selected of course :-) 

    Since the ManyToMany.ascx control does not work with DomainServices, I am trying to create my own.

    This is the model I have

    Users<------Company------->WorkGroup

    One company has many users and one company has many WorkGroups

    There is also a many to many relationship between Users and WorkGroups. So one user can belong to many workgroups and one workgroup can be assigned to more than one user belonging to that particular company

    User-------Workgroup

    This is the pseudo code I am thinking:

    protected void CustExpr_Querying(object sender, CustomExpressionEventArgs e)
    {
          if(sender == tblWorkgroup)
         {
                          // Only retrieve the workgroups that have the same id as the selected company value of DropDwonList
                           e.Query = e.Query.Cast<tblWorkGroup>().Where(
                                   wg => wg.CompanieID == DropDwonList.SeldctedValue);
          }
    }

    Then somewhere in the control I need to write code to select the workgroup check boxes that the user is assigned to.

    I think the pseudo code would be something like this:

    // Get workgroups that have user
    var workgroups = context.tblWorkGroups.Where(wg.tblUser.any())

    foreach(ListItem item in CheckBoxList)
    {
         foreach(var wg in workgroups)
             if(item.Value == wg.Id)
                 item.checked = true
    }
                      

    Am I in the right path? I am not sure where to add code in the page or control

    Cheers

    C          

    Sunday, February 26, 2012 11:25 AM
  • User-330204900 posted

    if this is just a custom page I would just hard code it, I would also do that if I were creating a custom Field Template for just one case. When I have a little time I will look at an M:M for Domnain Service.

    Sunday, February 26, 2012 12:20 PM
  • User1432255915 posted

    Hi Steve,

    Thanks for the reply.

    I dont mind hard coding or creating a custom Field Template for this case. The problem is that I am not sure how to do that.

    This is something that might take half an hours for someone who understands the structure of DD but I have been trying to get this to work for 2 days now to no avail.

    Could you please share some simple sample code to show me how to create this control?

    Cheers

    C

     

     

     

     

    Sunday, February 26, 2012 4:32 PM
  • User-330204900 posted

    Hi Pallone, take this offline and e-mail me Monday and I will see what I can do for you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 26, 2012 8:04 PM
  • User1432255915 posted

    Hi Steve,

    Thanks.

    Tuesday, February 28, 2012 5:05 AM
  • User-526354650 posted

    pallone,

    Let me try to play a devil's advocate for a minue. Why do you want to use domain services in a web application? Why not use the Entity Framework directly?

    Oleg

    Tuesday, February 28, 2012 2:11 PM
  • User1432255915 posted

    Hi Oleg,

    If you want to go from a 2 tier application to a 3 tier application, you need to use Domain Service.

    Domain Service is becoming more and more prominent in Web Applications. It was introduced to be used with Silverlight but the next version of a web technology called vNExt will use Domain service to fetch data from the server.

    Hope this helps.

     

    Tuesday, February 28, 2012 5:45 PM
  • User-330204900 posted

    Actually Pallone, it will be mor likely OData or Web API

    Tuesday, February 28, 2012 6:49 PM
  • User-526354650 posted

    I know what Domain Services are :). I also know why people think they need  3-tier applications - I thought so too when I've built my first well over a decade ago. The reason I wanted to ask this question is because, in web applications, the additional tiers are usually unnecessary - see Martin Fowler's first law of distributed computing. You can achieve better performance and scalability with the classic 2-tier architecture (not counting the client-side javascript, of course). Domain Service implements the facade pattern and a service layer over the underlying Entity Framework business layer. By accessing the EF business layer in a web application directly, you can eliminate an additional network hop and Dynamic Data will just work. If your app has a Silverlight component that requires a Domain Service, keep it as thin as possible, put the business logic into the EF layer and don't fight the framework. Just my 2 cents.

    Tuesday, February 28, 2012 7:23 PM
  • User1641955678 posted

    Claudio, you wrote earlier

    "Domain Service is becoming more and more prominent in Web Applications. It was introduced to be used with Silverlight but the next version of a web technology called vNExt will use Domain service to fetch data from the server."

    I know you've been watching my MIX09 talk, and at that time, the use of Domain Services in ASP.NET was definitely something we were looking at heavily. As it turned out, it didn't generate a huge amount of interest, which is why you're not finding all that much info about it today, and it hasn't moved very much since that time.

    In that sense, there is a risk in going down that route that if it doesn't work the way you need, there won't be as much resource out there to help. It is of course fine to use it if you find that it does what you need, but I wanted to make sure that you were aware that the situation now is different from what it was three years ago.

    And that is of course orthogonal to Oleg's point about whether the pattern is good or bad!

    Tuesday, February 28, 2012 7:56 PM
  • User1432255915 posted

    Hi Oleg,

    Thanks for your input.

    I would prefer not to have to use a 3 tier architecture if I could. It is much easier to use code behind and EntityDataSource to access the EF business layer directly.

    However, could you clarify to me what you would do in this scenarios?

    1 - You would have to repeat a lot of code in code behind.

    2 - In large companies / governments / most of the time the application architecture needs to follow a set of rules (focused on maintainability and security). These could be rules like the following:

    •The applications need to be developed following a Multitier architecture
    •Each tier should be physically separated for security.
    •The business logic tier is the only one that can connect to the data tier.
    •The presentation tier only connects to the business logic tier.
    •The presentation tier may not directly connect to the data tier.
    •The presentation tier is located in a DMZ, other tiers are heavily secured.
    •...

    In this scenario, since the web application is located in a DMZ zone, it can not access the business layer unless it  uses a service.

    If there is a better pattern to achieve all that using only a 2 tier approach I would appreciate if you let me know.

    Cheers

    C

     

     

     

    Wednesday, February 29, 2012 6:06 AM
  • User1432255915 posted

    Hi David,

    Thanks for sharing your knowledge with us and for the advice about Domain Serive.

    You wrote - "In that sense, there is a risk in going down that route that if it doesn't work the way you need, there won't be as much resource out there to help. It is of course fine to use it if you find that it does what you need, but I wanted to make sure that you were aware that the situation now is different from what it was three years ago."

    Could you please suggest an architecture for me to use based on the points I made in the post to Oleg?

    Cheers

    C

    Wednesday, February 29, 2012 6:11 AM
  • User1432255915 posted

    Hi Steve,

    Thanks.

    How do you use OData with DD? In OData when you reference the service, it will create local proxy classes for you and then you can use those classes to consume the service.

    I would like to see a sample application using Nothwind and OData with DD. Do you have anything demo that you could share with us?

    By the way, did you receive the sample app I sent to your email?

    Cheers

    C

     

    Wednesday, February 29, 2012 6:16 AM
  • User-330204900 posted

    David Ebbos has a sample for Standard WCF Services on aspnet.codeplex.com that could be adapted and in .Net 4.5 there are otherways to bind data in DD

    Wednesday, February 29, 2012 6:23 AM
  • User1432255915 posted

    Hi Steve,

    I cannot find David Ebbos' sample on codeplex. Have you got the URL?

    David can you help?

    Cheers

    C

    Wednesday, February 29, 2012 6:48 AM
  • User-330204900 posted

    it's here DynamicDataPrototypes.zip

    Wednesday, February 29, 2012 9:59 AM
  • User1432255915 posted

    Hi Steve,

    thanks.

    I downloaded the project and compiled it ok. But there is no service in there. Are you sure this is the right sample?

    Cheers

    C

     

    Wednesday, February 29, 2012 11:22 AM
  • User-330204900 posted

    That is the one he mentioned when  he last posted here about WCF Services see his post here How to access a WCF Data Service from an ASP.NET Dynamic Data

    Wednesday, February 29, 2012 11:24 AM
  • User1641955678 posted

    I have a Dynamic Data OData sample on Github.

    Wednesday, February 29, 2012 4:07 PM
  • User-330204900 posted

    Hi David, what do you download? I've never used GitHub :(

    Wednesday, February 29, 2012 5:08 PM
  • User1641955678 posted

    If you just want to download it with using git, just click the ZIP button. Here is the direct download link.

    Wednesday, February 29, 2012 5:10 PM
  • User1432255915 posted

    Hi David,

    Could you please explain to us how we could make use of you DD + Data Services solution in a real application?

    Also, I am struggling to get it to work.

    Cheers

    C

     

    Wednesday, February 29, 2012 6:57 PM
  • User-330204900 posted

    Hi David, I did not see that button in my first look :)

    Wednesday, February 29, 2012 6:58 PM
  • User-330204900 posted

    It's a sample Pallone, you will have to get it working and then decide if you want to work that way, DD is most robust using EF, the only area I have considered using a DS with DD is when I wanted to pre filter by user, but I get around that with hidden filters now :)

    Wednesday, February 29, 2012 7:00 PM
  • User1641955678 posted

    The sample should just run as is. Can you be more specific what what you mean by "I am struggling to get it to work"?

    Though as Steve says, it's just a sample to demonstrate how DD can work with OData.

    Thursday, March 1, 2012 1:14 AM
  • User1432255915 posted

    This is the error I get when I set the DataServicesClient as the start up project.

    Also if I try to view the WcfDataService1.svc in browse, I only get to the list of the collections. If I try to add "/Customers" to the url then I get a 500 error. 

    Server Error in '/' Application.


    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
     <code></code>
     <message xml:lang="en-GB">An error occurred while processing this request.</message>
    </error>

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Services.Client.DataServiceClientException: <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
     <code></code>
     <message xml:lang="en-GB">An error occurred while processing this request.</message>
    </error>

    Source Error:

    Line 102:            // Execute the query
    Line 103:            MethodInfo executeMethod = source.GetType().GetMethod("Execute");
    Line 104: var queryOperationResponse = (QueryOperationResponse)executeMethod.Invoke(source, null); Line 105:
    Line 106:            // Get the count and set it in the Arguments


    Source File: C:\Downloads\Training\DD\davidebbo-DynamicDataWCFDataService-d741ede\davidebbo-DynamicDataWCFDataService-d741ede\Microsoft.Data.Services.WebControls\DataSource\DataServiceLinqDataSource.cs    Line: 104

    Stack Trace:

    [DataServiceClientException: <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code></code>
      <message xml:lang="en-GB">An error occurred while processing this request.</message>
    </error>]
       System.Data.Services.Client.QueryResult.Execute() +479382
       System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context, QueryComponents queryComponents) +137
    
    [DataServiceQueryException: An error occurred while processing this request.]
       System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context, QueryComponents queryComponents) +396
       System.Data.Services.Client.DataServiceQuery`1.Execute() +77
    
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
       System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
       System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335
       System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
       System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
       Microsoft.Web.Data.Services.Client.DataServiceLinqDataSourceView.ExecuteQuery(IQueryable source, QueryContext context) in C:\Downloads\Training\DD\davidebbo-DynamicDataWCFDataService-d741ede\davidebbo-DynamicDataWCFDataService-d741ede\Microsoft.Data.Services.WebControls\DataSource\DataServiceLinqDataSource.cs:104
       System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +343
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 <!-- [DataServiceClientException]: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code></code> <message xml:lang="en-GB">An error occurred while processing this request.</message> </error> at System.Data.Services.Client.QueryResult.Execute() at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents) [DataServiceQueryException]: An error occurred while processing this request. at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents) at System.Data.Services.Client.DataServiceQuery`1.Execute() [TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Microsoft.Web.Data.Services.Client.DataServiceLinqDataSourceView.ExecuteQuery(IQueryable source, QueryContext context) in C:\Downloads\Training\DD\davidebbo-DynamicDataWCFDataService-d741ede\davidebbo-DynamicDataWCFDataService-d741ede\Microsoft.Data.Services.WebControls\DataSource\DataServiceLinqDataSource.cs:line 104 at System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.GridView.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.dynamicdata_pagetemplates_listdetails_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\97a6b755\2451e437\App_Web_szh103no.1.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->

    Thursday, March 1, 2012 4:54 AM
  • User1641955678 posted

    You need to run DataServicesServer first, or the client won't have anywhere to connect to.

    Thursday, March 1, 2012 7:50 AM
  • User1799985857 posted

    What's the purpose of that many connectivity data sources? Do I need to know all of them? In other languages I may need different data sources because of the database itself, Oracle, MySql etc. and I need to have different connection providers but it doesn't seem to be teh case here so why too many of them?

    Yules

    Friday, March 2, 2012 12:51 AM
  • User-330204900 posted

    Hi there, there are new technologies comming along in vNext sutch as LightSwitch which exposes its data as OData so being able to access OData will be usfull for DD and ASP.Net the neat thing about LightSwitch is that it's business layers will allow filtering data by user on the server etc. but for the most part you will only need the Entity FRamework Project as that will connect to many DB sutch as Oracle and Sql Server with the right drivers etc.

    Friday, March 2, 2012 7:11 AM
  • User1432255915 posted

    Hi David,

    Even starting DataServicesServer first, it is not working for me.

    Cheers

    C

    Friday, March 2, 2012 7:43 AM
  • User1799985857 posted

    And LightSwitch  is a complement of dd? should you abandon dd or you can integrate both things? why so many products delivered at the same time? makes things quite complicated to digest


    Yules

    Friday, March 2, 2012 9:14 AM
  • User-330204900 posted

    LightSwitch is a RAD tool and allows rapid development of application like DD but there is less of a learning curve to it. download the trial here Download Visual Studio LightSwitch 2011

    Friday, March 2, 2012 10:38 AM
  • User1641955678 posted

    @pallone: to isolate, ignore the client project for now and just try running DataServicesServer. This is a plain OData service using EF, with no DD in the picture. So if that doesn't work, you might have DB issues or something.

    BTW, this thread now seems to be tracking 3 or 4 unrelated topics that have nothing to do with the subject line (which is DomainDataSource).

    I suggest starting different threads to discuss different topics, and this will be very hard to read through for people finding this thread later and only interested on one of the topics.

    Friday, March 2, 2012 1:49 PM