コード例 #1
0
        /// <summary>
        /// Get a EF6.StaffDept object from the database using the given DeptId
        /// </summary>
        /// <param name="deptId">The primary key value</param>
        /// <returns>A EF6.StaffDept object</returns>
        public static EF6.StaffDept Get(Guid deptId)
        {
            EF6.StaffDept result = null;

            using (var ctx = new EF6.RT2020Entities())
            {
                result = ctx.StaffDept.Where(x => x.DeptId == deptId).AsNoTracking().FirstOrDefault();
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Get a EF6.StaffDept object from the database using the given QueryString
        /// </summary>
        /// <param name="deptId">The primary key value</param>
        /// <returns>A EF6.StaffDept object</returns>
        public static EF6.StaffDept Get(string whereClause)
        {
            EF6.StaffDept result = null;

            using (var ctx = new EF6.RT2020Entities())
            {
                result = ctx.StaffDept
                         .SqlQuery(string.Format("Select * from StaffDept Where {0}", whereClause))
                         .AsNoTracking()
                         .FirstOrDefault();
            }

            return(result);
        }