Ejemplo n.º 1
0
 /// <summary>
 /// Get Single Data From Database
 /// <para>Use it when to retive single data through a stored procedure</para>
 /// </summary>
 public T ExecuteQuerySingle(string spQuery, object[] parameters)
 {
     using (context = new dbDevEntities())
     {
         return(context.Database.SqlQuery <T>(spQuery, parameters).FirstOrDefault());
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get Data From Database
 /// <para>Use it when to retive data through a stored procedure</para>
 /// </summary>
 public IEnumerable <T> ExecuteQuery(string spQuery, object[] parameters)
 {
     using (context = new dbDevEntities())
     {
         return(context.Database.SqlQuery <T>(spQuery, parameters).ToList());
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Insert/Update/Delete Data To Database
        /// <para>Use it when to Insert/Update/Delete data through a stored procedure</para>
        /// </summary>
        public int ExecuteCommand(string spQuery, object[] parameters)
        {
            int result = 0;

            try
            {
                using (context = new dbDevEntities())
                {
                    result = context.Database.SqlQuery <int>(spQuery, parameters).FirstOrDefault();
                }
            }
            catch { }
            return(result);
        }
Ejemplo n.º 4
0
 public GenericRepository(dbDevEntities context)
 {
     this.context = context;
     entities     = context.Set <T>();
 }
Ejemplo n.º 5
0
 public CustomerRepository(dbDevEntities context)
 {
     this.context = context;
 }