Executing a database command using this method is very close to use ADO.NET and allows you to execute an arbitrary database command using familiar methods.

In the below code _dstore refers to an instance of IDataStore

	IDbCommand cmd = _dstore.Connection.GetCommand();
	cmd.CommandText = "select * from foo;";
	cmd.Parameters.Add(_dstore.Connection.GetParameter("@parm1", "Hello"));
	
	//if you are using the extension lib you can do this..
	cmd.AddParameter("@parm2", "hello");
	
	//to execute it you simply do (as appropriate)
	_dstore.ExecuteCommand(cmd);
	_dstore.ExecuteCommandLoadList<MyObject>(cmd);
	_dstore.ExecuteCommandLoadObject<MyObject>(cmd);

Last edited May 30, 2013 at 3:12 AM by iamkrillin, version 2

Comments

No comments yet.