DataClassesDatacontext Stackoverflow when submitting changes

0

I am currently trying to update values in my Database. My code worked flawlessly until I've added a new value to the Database. I have updated my DataClasses1.dbml and it shows the new column I have added to the Database. Still I am getting a Stackoverflowexception when context.SubmitChanges() gets called. The ChangeSet contains 2 Objects which should be updated (update 5 columns per row in this case)

            var customers = new List<Customer>();
            using (var context = new DataClasses1DataContext())
            {
                var result = from custs in context.Customer
                             where custs.ACTION_ID == desRequest.First().ACTION_ID &&
                                    !custs.ARCHIVATED
                             select custs;

                Inputvalidation.SetAddressLines(ref result);
                context.SubmitChanges();
                customers = result.ToList();
            }

context.GetChangeSet shows:

{{Inserts: 0, Deletes: 0, Updates: 2}}
    Deletes: Count = 0
    Inserts: Count = 0
    Updates: Count = 2

Before the update of each row I'm adding new customers from a json-post in nancyfx with this code (which to my surprise still works as intended)

    private static bool AddItems(string request)
    {
        // Hier alle sammeln und in einem wisch rein
        var customers = JsonConvert.DeserializeObject<IEnumerable<Customer>>(request);
        foreach (var cstmr in customers)
        {
            using (var context = new DataClasses1DataContext())
            {
                context.Customer.InsertOnSubmit(cstmr);
                try
                {
                    context.SubmitChanges();
                }
                catch (Exception)
                {
                    //TODO: Hier ggfs. reparieren
                    context.SubmitChanges();
                    return false;
                }
            }
        }
        return true;
    }

These are the error-details: These are the error- "Das Programm "[8028] iisexpress.exe" wurde mit Code -2147023895 (0x800703e9) beendet."

The Stacktrace shows null. What am I doing wrong and what can I improve?

c#
.net
linq-to-sql
asked on Stack Overflow Nov 17, 2016 by Zoba • edited Nov 17, 2016 by Zoba

1 Answer

0

I've deleted the "obj" Folder of my Solution and rebuilt the Project and everything works as intended again.

answered on Stack Overflow Nov 18, 2016 by Zoba

User contributions licensed under CC BY-SA 3.0