如何使用带有投影INKitAssembly投影类的扩展表? [英] How to work with Extension Table with projection INKitAssembly projection class?

查看:122
本文介绍了如何使用带有投影INKitAssembly投影类的扩展表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是扩展DAC和图代码,INRegisterKitAssemblyExt是DAC,我为此创建了一个数据库表。我想将usrSiteID值保存在INRegisterKitAssemblyExt(separate)数据库表中。请检查如何使用INKitRegister DAC初始化扩展DAC并保存该值以及如何在UI中使用usrSiteId?

Below is extension DAC and Graph code, INRegisterKitAssemblyExt is a DAC, i have created a database table for that. i want to save usrSiteID value in INRegisterKitAssemblyExt(separate) database table. Please check how may i initialize extension DAC with INKitRegister DAC and save the value and how to use usrSiteId in UI?

[PXTable(typeof(INKitRegister.refNbr), typeof(INKitRegister.KitRevisionId))] 
public class INRegisterKitAssemblyExt: PXCacheExtension<INKitRegister> { 

      #region RefNbr

        public abstract class refNbr:PX.Data.BQL.BqlString.Field<refNbr> {
        }
        protected String _RefNbr;
        [PXDBDefault(typeof(INKitRegister.refNbr))]
        [PXDBString()]
        [PXParent(typeof(Select<INKitRegister, Where<INKitRegister.refNbr, Equal<Current<refNbr>>,And<INKitRegister.kitRevisionID, Equal<Current<kitRevisionID>>>>>))]
        public virtual String RefNbr {
            get {
                return this._RefNbr;
            }
            set {
                this._RefNbr = value;
            }
        }

        #endregion


        #region KitRevisionID

        public abstract class kitRevisionID:PX.Data.BQL.BqlString.Field<kitRevisionID> {
        }
        protected String _KitRevisionID;
        [PXDBDefault(typeof(INKitRegister.kitRevisionID))]
        [PXDBString()]

        public virtual String KitRevisionID {
            get {
                return this._KitRevisionID;
            }
            set {
                this._KitRevisionID = value;
            }
        }

        #endregion

   // My Fields as well as refNbr and KitRevison is also here 
        public virtual int? UsrQCSiteID {
            get; set;
        }
        public abstract class usrQCSiteID:PX.Data.BQL.BqlInt.Field<usrQCSiteID> {
        }

} 

    // Extension Graph

    public class KitAssemblyEntryExt:PXGraphExtension<KitAssemblyEntry> {

    }


推荐答案

INRegisterKitAssemblyExt在您的代码示例中不是DAC。
DAC继承自IBqlTable基类。

INRegisterKitAssemblyExt in your code example is not a DAC. DAC inherits from the IBqlTable base class.

INRegisterKitAssemblyExt是DAC扩展。
DAC扩展继承自PXCacheExtension基类。
切勿为DAC扩展创建数据库表。

INRegisterKitAssemblyExt in your code example is a DAC extension. DAC extensions inherits from the PXCacheExtension base class. You should never create database table for DAC extensions.

DAC扩展中的自定义字段将自动保存到基本DAC表中。
此处的主要问题是INKitRegister不是DAC绑定到数据库表。
这是一个投影DAC,INKitRegister数据库表不存在。

Custom fields in DAC extension will be persisted to the base DAC table automatically. The main issue here is that INKitRegister is not DAC bound to a database table. It's a Projection DAC and the INKitRegister database table does not exist.

INKitRegister DAC投影指向INRegister DAC:

The INKitRegister DAC projection points to the INRegister DAC:

[PXPrimaryGraph(typeof(KitAssemblyEntry))]
[PXCacheName(Messages.INKit)]
[PXProjection(typeof(Select2<INRegister, InnerJoin<INTran, On<INRegister.FK.KitTran>>>), Persistent=true)]
[Serializable]
public partial class INKitRegister : IBqlTable, ILSPrimary

您应该在INRegister DAC而不是INKitRegister上创建扩展名,因为INRegister绑定到同名的实际数据库表:

You should create an extension on the INRegister DAC instead of INKitRegister because INRegister is bounded to an actual database table of the same name:

public class INRegisterKitAssemblyExt: PXCacheExtension<INRegister>

这篇关于如何使用带有投影INKitAssembly投影类的扩展表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆