Monthly Archives: June 2010

Vermont.NET User Group: Tomorrow night switch to EF4 instead of ASP.NET 4.0

The speaker originally scheduled is ill and can’t make it tomorrow night (would have been a 4 hour drive to Burlington). So rather than cancel the meeting, I will do an Entity Framework 4.0 Intro presentation. I’ll be happy to address more advanced questions once the intro is complete.

We are grateful to have a pizza/soda sponsor, FIT Solutions (www.fitsolutions.us).

Please register at vtdotnet.eventbrite.com so we order enough pizza and you are registered for the raffles. Lots of swag goodies!

When: Monday June 14th, 6-8:30pm

Where: GE Healthcare, 40 IDX Drive, South Burlington, VT

Vermont IT Jobs: C# Developer in Burlington

Senior C# Engineer Qualifications:

  • 5+ years of programming experience
  • Strong C# development skills
  • Thorough grounding in Object-Oriented design principles and design patterns
  • Bachelor’s Degree in Computer Science or related field
  • Strong message-oriented development skills (JMS, MSMQ, TCP/IP, Web Services, etc.)
  • Agile development background (understanding of methodology, terms, and process)
  • Demonstrated teamwork and flexibility in previous work assignments
  • Experience working closely with QA, Documentation, and Technical Support
  • Strong communication skills with technical and non-technical personnel
  • Demonstrated analytic and problem solving skills
  • Candidates must be organized, detail oriented, and professional

Kathie Cheney, PHR
Technical Connection, Inc.
P.O. Box 1402
Burlington, VT 05402
Tel: 802-658-8324
Fax: 802-658-0175
email: vermontjobs@vttechjobs.com

My Inbox: How to save changes coming from disconnected POCOs

I receive a lot of random emails from developers with Entity Framework questions. (This is not a request for more! :)) If I’m too busy to even look or if it’s something I can’t answer off the top of my head, I swallow my pride and ask the person to try the MSDN forums. If the email is from a complete stranger and has gobs and gobs of code that email will surely get a "please try MSDN forums" reply. 

But sometimes I’m not in my usual state of “too much to do” panic and get a question that is short & sweet and I can answer it effortlessly. This is one of those types of questions.

Question from Arda Çetinkaya

Hi;

I am contacting with you with a suggestion of my friend who is one of the best MVPs of Turkey…So I have a small question if you can answer it I will be very happy…

What I am trying to do is updating a poco entity with entity framework…My poco entity is not in context,so I am attaching it first…But no change is done…How can I update my poco entities…If you have any resource for it,I really need it…

Reply

You would have the same problem with EntityObjects as with POCOs. If you are using EF4, then you have a lot of options that you did n ot have in EF1.

Assuming it’s EF4, the simplest is to use the new ObjectContext.ObjectStateManager.ChangeState (might be ChangeObjectState) method. But that means you need to know what the state should be …added, updated or deleted.

That’s just one way and might be just what you need or might not fit your scenario.

If you search for changestate/changeobjectstate and Entity Framework on the web you should find lots of blog posts and articles on this.

Good Luck

julie

Follow-up from Arda 20 minutes later

Thanks a lot for your reply…It helped me to clear it out…

With the following code change, I got it…Thanks a lot…You saved my life (:

 public static void UpdateConfigurationSetting(ConfigurationSetting configurationSettingToUpdate)
{
  try
  {
    using (DBEntities entities = new DBEntities ())
    {
      entities.ConfigurationSetting.Attach(configurationSettingToUpdate);
      ObjectStateEntry entry = entities.ObjectStateManager
.GetObjectStateEntry(configurationSettingToUpdate); entry.ObjectStateManager
.ChangeObjectState(configurationSettingToUpdate, System.Data.EntityState.Modified); entities.SaveChanges(); } } }