博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
EF 数据查询(更改默认排序)
阅读量:7220 次
发布时间:2019-06-29

本文共 2107 字,大约阅读时间需要 7 分钟。

数据实体对象

public class ProductInvLocationMapEntity:BaseDomain    {        #region Constructors        public ProductInvLocationMapEntity()        { }        #endregion        #region Properties        ///         ///         /// AllowNull: False        /// Length: 8        ///         //public long Id { get; set; }        ///         /// 商品id        /// AllowNull: False        /// Length: 8        ///         public long ProductId { get; set; }        ///         /// 商品货号        /// AllowNull: False        /// Length: 50        ///         public string ProductCode { get; set; }        ///         /// 库位编号        /// AllowNull: False        /// Length: 50        ///         public string LocationLabel { get; set; }        ///         /// 库位类型        /// AllowNull: False        /// Length: 50        ///         public string LocationType { get; set; }        ///         /// 生产日期        /// AllowNull: False        /// Length: 8        ///         public DateTime ManufactureDate { get; set; }        ///         /// 已存放数量        /// AllowNull: False        /// Length: 4        ///         public int StoredQty { get; set; }                #endregion        #region override Mehtods        public override string ToString()        {            return base.ToString();        }        #endregion        ///         /// 仓库Id        ///         public long WarehouseId { get; set; }    }

数据操作方法

///         ///         ///         ///         ///         /// 
public Models.EF6_Test.ProductInvLocationMapEntity GetMatchedLocationMap(long product_id,DateTime manufacture_date) { DateTime maxValue = new DateTime(9999, 12, 31, 23, 59, 59);#if DEBUG this.OpenSqlRawOutput(Console.WriteLine);#endif var matched_entity = this.EntrySet .OrderBy(obj=>obj.ModifiedTime) .FirstOrDefault(obj => (obj.ProductId == product_id && obj.ManufactureDate == manufacture_date) || (obj.ProductId == product_id && obj.ManufactureDate == maxValue)); return matched_entity; }

 
 
 

转载于:https://www.cnblogs.com/xakml/p/7049086.html

你可能感兴趣的文章
lua + redis 的去重队列
查看>>
web负载均衡(ipvsadm)(未成)
查看>>
抓取存储quota超过80%的users
查看>>
C语言经典算法100例
查看>>
速成CAD版本转换的教程
查看>>
CAD文件图纸过大,该怎么解决?
查看>>
Spring aop 切不进去原因。。
查看>>
PHP获取客户端IP
查看>>
php开发APP接口-封装通信接口改进版
查看>>
Android系统性能演变历程
查看>>
OSChina 周三乱弹 —— 打醒精神去瞌睡
查看>>
SSH 密钥登录linux
查看>>
你必须掌握的 21 个 Java 核心技术!
查看>>
告诉你WHT中文站是什么?
查看>>
4、Juniper SSG520 PPTP映射到ROS后MAC无法连接解决方法
查看>>
利用批处理文件来建立一个记录3389登陆者信息
查看>>
Linux 系统下双机HA的实现
查看>>
02_swarm mode key concepts
查看>>
Eclipse打包插件Fat Jar 解压打包
查看>>
Apache Shiro 使用手册
查看>>