New Posts New Posts RSS Feed: Setting NULL into a column
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Setting NULL into a column

 Post Reply Post Reply
Author
dkearney1 View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Jul-2007
Location: United States
Posts: 27
Post Options Post Options   Quote dkearney1 Quote  Post ReplyReply Direct Link To This Post Topic: Setting NULL into a column
    Posted: 28-Jan-2009 at 12:05pm
I can't believe I'm not getting this.

I've got a table ContractFunds, with a nullable column FundSource, which refers to a FundSource table. The ServerModel and DomainModel entities exist and have no interesting bits.

I create ContractFund record by hand, having NULL in the FundSource column, and having retrieved this record via IdeaBlade, the FundSource property is (correctly) a NullEntity (IsNullEntity == true). I continue by retrieving an appropriate FundSource, set it into the ContractFund, save, and the record in the database is updated. Now I want to undo that last action. I retrieve the ContractFund, set the FundSource to null, which appears to have the desired effect, but after the save the record in the database still has a value in the FundSource column. I know the save worked because the housekeeping columns have updated. When I crank up the Profiler, the update statement shows the housekeeping columns being updated, but the changes to the FundSource column aren't there.

Here's the code:
     Contract testContract = Contract.Get(em, 7);
     ContractFund fund = testContract.ContractFunds[0];
     FundSource fundSource = fund.FundSource;

     if (fundSource.EntityAspect.IsNullEntity)
     {
          FundSource newSource = FundSource.Get(em, "FAA");
          fund.FundSource = newSource;
     }
     else
     {
          fund.FundSource = null;
     }

     if (em.HasChanges())
          em.SaveChanges();

What am I missing?
Dan
“In anything at all, perfection is finally attained not when there is no
longer anything to add, but when there is no longer anything to take away.”
Saint-Exupéry
Wind, Sand, and Stars
Back to Top
dkearney1 View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Jul-2007
Location: United States
Posts: 27
Post Options Post Options   Quote dkearney1 Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2009 at 5:55am
Any help?
Dan
“In anything at all, perfection is finally attained not when there is no
longer anything to add, but when there is no longer anything to take away.”
Saint-Exupéry
Wind, Sand, and Stars
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2009 at 9:41am

Dan, 

Sorry, your first post somehow slipped by us.
 
This problem is actually due to a bug, which we fixed in early January.  Unfortunately, we haven't had a release since December, so this is no help to you right now.  The next release is tentatively scheduled for late this month (February). 
Back to Top
dkearney1 View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Jul-2007
Location: United States
Posts: 27
Post Options Post Options   Quote dkearney1 Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2009 at 10:40am
OK, for the time being I'll add records to the FundSource table that represent the lack of a fund source and wait for the fix.

How tentative is "tentatively scheduled" ?
Dan
“In anything at all, perfection is finally attained not when there is no
longer anything to add, but when there is no longer anything to take away.”
Saint-Exupéry
Wind, Sand, and Stars
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2009 at 10:45am
Good question.  The schedule is currently under discussion, but it will be 2 - 6 weeks (with engineering voting for 2 weeks).  I'll post again once we have a firm date, or you can contact support directly if I'm remiss.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down