Question: I am using EF4 Self Tracking Entities (VS2010 Beta 2 CTP 2 plus new T4 generator). But when I try to update entity information it does not update to database as expected.

I setup 2 service calls. one for GetResource(int id) which return a resource object. the second call is SaveResource(Resource res); here is the code.

```
    public Resource GetResource(int id)
    {
        using (var dc = new MyEntities())
        {
            return dc.Resources.Where(d => d.ResourceId == id).SingleOrDefault();
        }        
    }

    public void SaveResource(Resource res)
    {
        using (var dc = new MyEntities())
        {
            dc.Resources.ApplyChanges(res);
            dc.SaveChanges();
            // Nothing save to database.
        }      
    }

    //Windows Console Client Calls
    var res = service.GetResource(1);
    res.Description = "New Change"; // Not updating...
    service.SaveResource(res); 

    // does not change anything.

```

It seems to me that ChangeTracker.State is always show as "Unchanged".

anything wrong in this code?

Answer: 
You have to share assembly with STEs between client and service - that is the main point. Then when adding service reference make sure that "Reuse types in referenced assemblies" is checked.

The reason for this is that STEs contain logic which cannot be transfered by "Add service reference", so you have to share these types to have tracing logic on client as well.
I had the same exact problem and found the solution.

It appears that for the self-tracking entities to automatically start tracking, you need to reference your STE project before adding the service reference.

This way Visual Studio generates some .datasource files which does the final trick.

I found the solution here:
<http://blogs.u2u.be/diederik/post/2010/05/18/Self-Tracking-Entities-with-Validation-and-Tracking-State-Change-Notification.aspx>

As for starting the tracking manually, it seems that you do not have these methods on the client-side.

Hope it helps...