Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
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?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement