General information
Category:
The Mere Mortals .NET Framework
Title:
GetEntity and CommandType
How do you handle times when you want to make a call to GentEntity() using a command type of CommandType.Text, but you might also need to make a call using a stored proc, in which case command type will be CommandType.StoredProcedure
For instance:
return this.GetEntity("OrdersSelectByPK", this.CreateParameter("@OrderID", orderID));
vs.
return this.GetEntity("SELECT * FROM Orders WHERE OrderID = @OrderID", this.CreateParameter("@OrderID", ...));
I know you can set DefaultCommandType to one or the other, but I could see needing to use both in my programming; So how do you swap back and forth? In other words, how could I pass a command string and override the default command type if I knew my command was not the default type?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only