public int NuevoTest(myTest a) { int res = 0; SqlConnection cnn = new SqlConnection(cadenaConection); try { cnn.Open(); SqlCommand cmd = new SqlCommand("spInsertTest", cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pName", a.Nombre); res = cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Error to insert the record", ex); } finally { cnn.Close(); } return(res); }
static int Main (string [] args) { myTest test = new myTest (); if (test.Read () != 1) return 1; return 0; }
IEnumerator Start() { int loopCount = 1000 * 1000; loopCount = 10000 * 100000; //loopCount = 10000; var test = new myTest(); var iTest = test as ITest; int sum = 0; yield return(new WaitForSeconds(1)); CpuProfilerBase( () => { for (int i = 0; i < loopCount; ++i) { } } ); yield return(new WaitForSeconds(1)); CpuProfiler("value...", () => { for (int i = 0; i < loopCount; ++i) { sum = test.value; } } ); yield return(new WaitForSeconds(1)); CpuProfiler("normalProperty...", () => { for (int i = 0; i < loopCount; ++i) { sum = test.normalProperty; } } ); yield return(new WaitForSeconds(1)); CpuProfiler("virtualProperty...", () => { for (int i = 0; i < loopCount; ++i) { sum = iTest.virtualProperty; } } ); }
IEnumerator Start () { int loopCount = 1000 * 1000; loopCount = 10000 * 100000; //loopCount = 10000; var test = new myTest(); var iTest = test as ITest; int sum = 0; yield return new WaitForSeconds(1); CpuProfilerBase( () => { for (int i = 0; i < loopCount; ++i) { } } ); yield return new WaitForSeconds(1); CpuProfiler("value...", () => { for (int i = 0; i < loopCount; ++i) { sum = test.value; } } ); yield return new WaitForSeconds(1); CpuProfiler("normalProperty...", () => { for (int i = 0; i < loopCount; ++i) { sum = test.normalProperty; } } ); yield return new WaitForSeconds(1); CpuProfiler("virtualProperty...", () => { for (int i = 0; i < loopCount; ++i) { sum = iTest.virtualProperty; } } ); }
public List <myTest> ListarTest(string id) { SqlConnection cnn = new SqlConnection(cadenaConection); List <myTest> l = new List <myTest>(); myTest mt = null; try { cnn.Open(); SqlCommand cmd = new SqlCommand("spListTest", cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pName", id); SqlDataReader r = cmd.ExecuteReader(); if (r.HasRows) { while (r.Read()) { mt = new myTest(); mt.Id = r.GetInt32(0); mt.Nombre = r.GetString(1); l.Add(mt); } } } catch (Exception ex) { l = null; throw new Exception("Error to insert the record", ex); } finally { cnn.Close(); } return(l); }