axapta - Static new and inheritance -


As preserved new method instead of establishing and using the new ... methods to reduce the lack of method overloading Recommend.
So I have explained the use of this method

But there is no legacy inherited. I had a look at the system sections hoping to find one so we have to define each sub-class stable construction and stable new methods .... Therefore, we lose some of the benefits of inheritance.

Better solution but what I saw does not really help me:
- Respect some new stable patterns and declare methods in subclasses - some examples of it without security Use New SalesFormLetter_Confirm Return (GetParmId: A "Square Factory", SalesFormLetter

  Constant SalesFormLetter Creation (DocumentStatus Document, Boolean getParmId = true) {Switch (Document) {Case DocumentStatus :: Mother class as the kind of confirmation;); Case Document Stats :: Picklist List: Returns SalesFormLetter_PickingList :: Creation (getParmId); Case Document Stats :: Packing Slip: New SalesFormLetter_PackingSlip for return (getParmId); Case Document Stats :: Project Packing Slip: Returning to New Sales Form_PottingSlip Project (getParmId); Case Document Stats: Invoice: Return new SalesFormLetter_Invoice (getParmId); Case Document Stattus :: Project invoice: Return new SalesFormLetter_InvoiceProject (getParmId); Default: throw error (strfmt ("@ SYS19306", funka name ())); } Throw error (strfmt ("@ SYS19306", funka name ())); }   

If there is a better solution, and therefore I am not thinking, then what would be the best of these?

A better solution to object on construction?

Well, new has to go somewhere, and put a lot of new in the client code is delicate and inflexible especially if the related sections Let's go with the class "factories".

Two options:

  1. Make new protect. Build one for each sub-class, call the builders of sub-classes and build a factory in the base class. But then any call to sub-class building method can call.

  2. Make the new do not create the creation of each sub-class in the public, building the factory in base class, new in subclasses. As the new can not be preserved because the base class does not descend from the sub-classroom.

    Whether you go with 1 or 2, your choice is, you end up exposing sub-class constructor I personally prefer option 2 I am because it is the least problem.

    Tip: Explain your object dependency using the arguments on new . This will complicate your factories, but this is fine because it transfers the complexity of your client code Setter methods ( parm methods) are bad, but required for RunBase Because it is necessary for the batch system.

    Also see what they write.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -