zoukankan      html  css  js  c++  java
  • Ndo 新版本发布

          这个版本的Ndo对视图的支持增强了,并且增强对实体类的单表映射,下个版本将增加对一对多关联关系的支持!
          简单介绍一下,实体类的使用方法:
    using System;
    using NDO;

    namespace NDOShippers
    {
        
    public class EntityShipper:Entity
        {
            
            
    public EntityShipper():base("Shippers")
            {
            }
            
            
    public override NDO.Entity NewInstance()
            {
                
    return new EntityShipper();
            }
            

            
    public int ShipperID
            {  
                
    get { return this.settings.GetInt32("ShipperID"); }
                
    set { this["ShipperID"= value; }
            }
            
    public string CompanyName
            {  
                
    get { return (string)this["CompanyName"]; }
                
    set { this["CompanyName"= value; }
            }
            
    public string Phone
            {  
                
    get { return (string)this["Phone"]; }
                
    set { this["Phone"= value; }
            }
            
            
        }
    }

    Shipper 类的CRUD操作代码如下:
    INDOManager nm = NDOManager.Instance;
                EntityShipper shipper 
    = new EntityShipper();
                shipper.CompanyName 
    = "NDO Test";
                shipper.Phone 
    = "(101)  555-6666";

                
    //insert a shipper record
                nm.Save(shipper);
                Console.WriteLine(shipper.ShipperID);

                EntityShipper shipper2 
    = nm.Load(typeof(EntityShipper),shipper.ShipperID) as EntityShipper;
                Console.WriteLine(
    " CompanyName = {0}\t Phone = {1} ",
                    (
    string)shipper2.CompanyName,
                    (
    string)shipper2.Phone);


                
    //update shipper record
                shipper2.CompanyName = "update ndo test!";
                shipper2.Phone 
    = "(101) 666-8888";
                nm.Save(shipper2);

                EntityShipper shipper3 
    = nm.Load(typeof(EntityShipper),shipper.ShipperID) as EntityShipper;
                Console.WriteLine(
    " CompanyName = {0}\t Phone = {1} ",
                    (
    string)shipper3.CompanyName,
                    (
    string)shipper3.Phone);


                
    //delete a shipper
                nm.Delete(shipper3);

                
    //check delete result
                EntityShipper shipper4 =  nm.Load(typeof(EntityShipper),shipper.ShipperID) as EntityShipper;
                Console.WriteLine(shipper4.CompanyName 
    == null || shipper4.CompanyName == "");
                Console.ReadLine();
  • 相关阅读:
    【科创人独家】科界CTO林镇南:言必真,行必果,没有尽力而为,只有全力以赴
    【科创人+极客邦科技】百企贡献资源,携手抗击疫情
    【科创人新春篇】创投圈人脉王吴世春:肺炎,Long China,精益创业,回归听云…
    SAP QM 在Quality Notification里维护Internal Note
    地摊重现江湖,疫情带给我们的意外收获
    SAP QM Quality Notification的凭证流
    SAP QM 如何将一个附件挂在一个Quality Notification单据上?
    K项目轶事之被客户通报批评
    SAP MM VL34事务代码批量创建Inbound Delivery
    城市的房价稳定,就能不断吸引人才?
  • 原文地址:https://www.cnblogs.com/netcasewqs/p/581251.html
Copyright © 2011-2022 走看看