Where to put custom procedure call?

Topics: General Discussion Forum
Aug 10, 2007 at 12:39 PM
Hi, I'm new to WSSE. I've started to develop with it few days ago and I have questions..
- Is there an option to create classes that calls procedures in db, which are not connected with certain tables (for example procedure named "GenerateHash")?
- Is there any standards for it (such as using repository for tables)?

This is my class, based on Repository class. I Dont know if this is right approach..

public class DBGenericFunctions
{
private string databaseName;
private Database db;

public OTGeneric(string databaseName)
{
this.databaseName = databaseName;
this.db = DatabaseFactory.CreateDatabase(databaseName);
}

public Int32 GenerateHash(Int32 aDocNumber, Int32 aUserID)
{
DbCommand command = db.GetStoredProcCommand("dbo.GenerateHash");
db.AddInParameter(command, "we1", DbType.Int32, aDocNumbe);
db.AddInParameter(command, "we2", DbType.Int32, aUserID);
db.AddOutParameter(command, "wy1", DbType.Int32, 1);
db.ExecuteNonQuery(command);

return (Int32)db.GetParameterValue(command, "wy1");
}
}