none
implement IUpdatable for WCF DataService using entities RRS feed

  • Question

  • OK, I'm wondering how to implement the IUpdatable interface correctly on a data service class that inherits from microsoft's DataService class.  I've seen posts on this, but it is difficult to understand what the code is doing as I am not familiar with doing this and do not know what all the code means and my scenario may be different, therefore copying and pasting won't really work.

    I found this link

    http://blogs.microsoft.co.il/blogs/gilf/archive/2008/08/31/how-to-perform-crud-operations-in-ado-net-data-services-with-custom-provider.aspx

    but apparently it's not Entities so the situation isn't exactly the same. So when I try to do this

       /// <summary>
            /// Construct a new CoursesDataContext object
    
            /// </summary>
    
            static CoursesDataContext()
    
            {
    
                _courses = Course.GetCourses();
    
            }
    

    Here, _courses is a list of the rows in the table, but

    My equivalent of "Courses" has no type of Get method. 

    thus I can't assign to a local List which will keep that data for the updating methods. 

        public class SupportF : DataService< MyNamespace.MyEntities>, IUpdatable
        {
    
            //// This method is called only once to initialize service-wide policies.
            public static void InitializeService(DataServiceConfiguration config)
            {
                config.SetEntitySetAccessRule("*", EntitySetRights.All);
                config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
                config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
                config.UseVerboseErrors = true;
            }
    }

    A lot of the search results in google that I find for how to implement IUpdatable include code that the blogger doesn't fully comment on so you can understand every detail, which is basically your typical blog I guess, but anyways it's a real challenge in this case to find out how to implement this in my scenario - using WCF service and Entities.

    I don't neglect to mark any answers as answers.

    This is a continuing problem, but I've reframed it because before I didn't realize that the issue is implementing the IUpdatable Interface, and hopefully someone who knows about this will see the title of my posting and respond.

    Wednesday, June 5, 2013 9:07 PM

Answers

  • On 6/5/2013 5:40 PM, jamesiw wrote:

    Never mind, unless anyone can prove otherwise, I have read another blog where someone says that Entity framework does updates out of the box in WCF services.  Anyways, unless someone can show otherwise, I guess this question that I posted is irrelevant if it's true that WCF services with entity framework update out of the box.

    WCF is geared around EF,  and the EF entities are an implicit serialized data-contract object to WCF, meaning the entities can be sent through WCF as is. In addition to this, an EF entity has behavior (methods) within the entity/object that can load the entity from the database, persist itself to the database or delete itself from the database when the behavior/methods in the EF entity are acted upon with code.

    Other than WCF Restful dataservice, the WCF service is going to have a Business Logic Layer and DAL Data Access Layer sitting behind the WCF service  with the DAL in communications with the database through the ORM. WCF is just a communications project between the WCF client and WCF service, passing serialized objects between the client and the service.

    Wednesday, June 5, 2013 10:36 PM

All replies

  • Never mind, unless anyone can prove otherwise, I have read another blog where someone says that Entity framework does updates out of the box in WCF services.  Anyways, unless someone can show otherwise, I guess this question that I posted is irrelevant if it's true that WCF services with entity framework update out of the box.
    Wednesday, June 5, 2013 9:40 PM
  • On 6/5/2013 5:40 PM, jamesiw wrote:

    Never mind, unless anyone can prove otherwise, I have read another blog where someone says that Entity framework does updates out of the box in WCF services.  Anyways, unless someone can show otherwise, I guess this question that I posted is irrelevant if it's true that WCF services with entity framework update out of the box.

    WCF is geared around EF,  and the EF entities are an implicit serialized data-contract object to WCF, meaning the entities can be sent through WCF as is. In addition to this, an EF entity has behavior (methods) within the entity/object that can load the entity from the database, persist itself to the database or delete itself from the database when the behavior/methods in the EF entity are acted upon with code.

    Other than WCF Restful dataservice, the WCF service is going to have a Business Logic Layer and DAL Data Access Layer sitting behind the WCF service  with the DAL in communications with the database through the ORM. WCF is just a communications project between the WCF client and WCF service, passing serialized objects between the client and the service.

    Wednesday, June 5, 2013 10:36 PM
  • Hi, here is a forum focus on WCF Data Service, you can get better reply there.

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads

    Thursday, June 6, 2013 8:46 AM