Update only certian properties on a detached entity

P

Paul Lemke

I want to update an entity without loading the entity from the database first.

I've accomplished this but only by knowing all of the entities properties
and then using the "attachto" method.

My issues is i don't want my app to need to remember all of the properties.
Example:

Dim customerEntitiy As New shopper
customerEntitiy.shopper_id = CustomerData.CustomerID
customerEntitiy.market_code = CustomerData.MarketSector
customerEntitiy.email = CustomerData.Email
customerEntitiy.modified = DateTime.Now
context.AttachTo("shopper", customerEntitiy)
context.SaveChanges()

That entity also has a "created" field on it. I don't want to pass this
"created" date all the way through my n-tier app. How can i just "not update"
that field when saving to the database?

Thanks! Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top