Columns associated with mappings have been deleted/renamed

1.1k views Asked by At

I have a Content Type called Activity that inherits form Event and i have a list instance called Activities and its content type is Activity When SPMetal Generates the entities i see the following classes

public partial class Activity : Event and public partial class ActivitiesActivity : Activity

when i write the following code to save a new entity

    public void Save(Activity activity)
    {
        var context = new MACEntitiesDataContext("http://localhost:8088");
        var activities = context.GetList<Activity>("Activity");
        activities.InsertOnSubmit(activity);
        context.SubmitChanges();
    }

it throws

Columns associated with mappings have been deleted/renamed

2

There are 2 answers

0
Roman On

Another resolution - I was attempting to SET a nullable bool value from an InfoPath form. My experience is that it is okay to update the xml values and save the form content back to the library, but it is not ok to update the promoted columns in such a case.

0
joe_coolish On

I know this is an old thread, but I just had this problem, and this was how I solved it.

I had a list that had a content type assigned to it. I added a few items and then generated the SPMetal. Well, the content type changed, and I updated it on the list and re-ran SPMetal. After all the testing was done, we deployed to production, and that's when the error occurred. We ran the same query in LinqPAD and everything worked fine. Just not from our Work Flow.

It turned out that because I had updated the Content Type on my list (the one where SPMetal was generated) it made some weird Virtual members to represent the changes. The other list (the production list) never had the original content type, so it didn't recognize the virtual members, and it blew up.

The way I fixed it was by deleting the Table, recreating it (same name), and re-assigning it the Content Type, then running SPMetal.