I am very new to entity framework. Nice concept and fast as well.
Working in c#.net right now. I have stucked here where datetime comes in picture.
I mean….
lets assume i have user table in DB where CreatedDate fields is there in with datetime datatype in sql db.
My entity framework works like this…
when i need to add object to db, i simply pass objUser.createdDate = DateTime.now.
How ever I want to change the concept for some requirement changes.
I need to store sql server DateTime() for createdDate field in table.
How can i do that???
any idea…please help.
follwoing is a just sample code of my project.
objCustomer.RegisterDate = DateTime.Now;
objCustRepository.AddCustomer(objCustomer);
I want to remove this DateTime.Now line and maintain through sql….
if you can store the value from stored procedure instead of your business logic then you can try it by following.
to store SQL
Datetimevalue then you can also useGETDATE()function in SQL.or
you can define
RegisterDatedefault value= GETDATE()