"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!
I have tried to reproduce this with a the following code, but for me it works using (DataClasses1DataContext ctx = new DataClasses1DataContext()) { var obj = ctx. DecimalColumnTables.First(); Debug. Assert(obj.
B! = 0); obj. B = 0; ctx.SubmitChanges(); } So I think there must be something special in your domain that causes this.
I suggest you to create a such simple repro with your domain model and see what happens LINQ to SQL ignores updates to the current value, so if the field was already zero, you may not see any updates Off: The OR/M you use is LINQ to SQL LINQ is the name of the querying capability in . NET, but LINQ does not define nor implement any update logic. So the issue relates to LINQ to SQL, not LINQ.
I have tried to reproduce this with a the following code, but for me it works. Using (DataClasses1DataContext ctx = new DataClasses1DataContext()) { var obj = ctx. DecimalColumnTables.First(); Debug.
Assert(obj. B! = 0); obj.
B = 0; ctx.SubmitChanges(); } So I think there must be something special in your domain that causes this. I suggest you to create a such simple repro with your domain model and see what happens. LINQ to SQL ignores updates to the current value, so if the field was already zero, you may not see any updates.
Off: The OR/M you use is LINQ to SQL. LINQ is the name of the querying capability in . NET, but LINQ does not define nor implement any update logic.So the issue relates to LINQ to SQL, not LINQ.
Thanks! I will check this out! – mattruma Dec 22 '08 at 15:01 You were right on @Gaspar Nagy ... Linq to Sql was ignoring the change.
– mattruma Dec 22 '08 at 19:07.
I figured out my problem with the help of the SO community. My problem was being caused by the fact when I created my entity to attach, the default value of the column was set to zero, so when it tried to assign the value to zero ... LinqToSql says hey ... nothing changed, so I am not updating the value. What I am doing now ... just to make it work is the following: ctx.DataContext.InvoiceItems.
Attach(data, true); That seems to force all the values to write themselves to the database. This works for now.
Some more information ... I figured out my problem ... it's more of a lack of understanding about LinqToSql ... where I am doing: private void Child_Update(Invoice parent) { using (var ctx = Csla.Data. ContextManager . GetManager(Database.
ApplicationConnection, false)) { var data = new Gimli.Data.InvoiceItem() { InvoiceItemId = ReadProperty(InvoiceItemIdProperty) }; ctx.DataContext.InvoiceItems. Attach(data); if (this. IsSelfDirty) { // Update properties } } } I thought this would load the original values ... what happens is that it creates a new object with default values ... empty values, like 0 for decimals, Guid.
Empty for uniqueidentifiers and so on. So when it updates the properties it sees the Units already as 0 and it sets it to zero. Well LinqToSql doesn't recognize this as a change so it doesn't up date the field.So what I have had to do is the following: ctx.DataContext.InvoiceItems.
Attach(data, true); Now all the modifications are generated in the update statement whether there is really a change or not. This works ... seems a bit hackish!
I had this problem and all the suggestions I'd seen didn't apply or work. But I found I had made a very simple mistake! When updating the property I was actually calling a custom Set method (because there were other things that needed to be changed in response to the main property in question).
After hours of head scratching I noticed that my Set method was updating the private member not the public property, i.e. This. _Walking = value; All I had to do was change this to this.
Walking = value; and it all started to work!
I have a decimal column in my database called Units, anytime I set the value of the column to a NON ZERO, and SubmitChanges the column updates with the new value. If I try to set the value of the column to ZERO, the SubmitChanges does not update the column. I've taken a look at the DataContext log and I can see that the field with the ZERO value is not included in the query.
Even if I try to hard code the change Linq ignores it.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.