what best method database server time in ef7? discovered far no support query output parameters.
if want use entity framework, can that:
having context:
// dbcontext public class ef7context : dbcontext { }
and utility function:
public static datetime getdbdatetime() { using (var context = new ef7context()) { using (var connection = context.database.getdbconnection()) { if (connection.state == connectionstate.closed) { connection.open(); } var command = connection.createcommand(); command.commandtext = "select sysutcdatetime()"; return (datetime)command.executescalar(); } } }
Comments
Post a Comment