Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.17 KB

File metadata and controls

30 lines (25 loc) · 1.17 KB

mcZen.Data

Simple transaction command based sql access.

Fetch Values

ConnectionFactory.Execute(
    new CommandReader(
	r => {
	    values.Add(new KeyValuePair<Guid, int>(r.GetGuid(0), r.GetInt32(1)));
	}, 
	"SELECT [key],[column] FROM [Table] WHERE [column]>@value", 
	System.Data.CommandType.Text,
	_options.Value.Timeout, 
	new SqlParameter("@value", 10)
    ), 
    _options.Value.ConnectionString);

Insert Values

factory.Register(mcZen.Data.Commands.Insert("[Table]", new SqlParameter("@key", Guid.NewGuid()), new SqlParameter("@value", 5)));
factory.Register(mcZen.Data.Commands.Insert("[Table]", new SqlParameter("@key", Guid.NewGuid()), new SqlParameter("@value", 3)));
factory.Register(mcZen.Data.Commands.Update("[Table]", new SqlParameter("@key", Guid.NewGuid()), new SqlParameter("@value", 4)));
factory.Register(mcZen.Data.Command("UPDATE [TABLE] SET [timestamp]=getutcdate()"));
factory.Register(mcZen.Data.Commands.Delete("[Table]", new SqlParameter("@key", Guid.NewGuid())));
factory.Execute();'