Grove-based .NET application development prompt

zhaozj2021-02-16  51

Grove-based .NET application development prompt

1. Try to avoid new mapping entities, mainly in relationship mapping entities. When the program needs to query a record that conforms to a certain condition, it is often necessary to query by a relational mapping entity. When the relationship entity is used in other calvity, sometimes it needs to add an inquiry field to the relationship mapping entity because it is missing some fields. Or re-establishing the entity, in the event of a relationship entity, you should try to consider the needs of other calorificers, which can effectively avoid the repetition of the relationship mapping entity or other uneastective factors caused by changes in the relationship entity.

2. Avoid the same functionality (method) in the data operating layer, although these functions may not belong to the same management class. When the caller needs to add or modify (including delete) an entity (non-relational entity), you should first check if there is an existence of this function in the façade layer, which requires a clear annotation of all management classes in the data operation layer. The functional description of each method is to exclude ambiguity.

3. When the entity maps, if the entity maps a primary table, it is generally specified that the subtray mapping item corresponding to the primary table. If the primary table name is Main, the sub-table is named SUB, the corresponding mapping entity is main.class and sub.class, the main entity should apply for sub-items as follows::

ArrayList_Childs = NULL;

Public ArrayList Childs

{

Get {

IF (this. _childs == null)

{

// o initial code

THIS._CHILDS = New ArrayList ();

This. _childs = oo.reterievechildObjects (this.id, this._childs, typeof (sub));

// oo release code

}

Return this.

}

Set {this._childs = value;

}

4. The definition of entity operations, the main tabular relationship should have transaction support, as follows:

Public void addmain (Main M)

{

// o initial code

o.begintransaction ();

Try {

o insertObject (m);

OO.insertObjects (M.CHILDS);

o.commit ();

}

Catch (Exception E)

{

Oo. rollback ();

Throw e;

}

oo.dispose (); // oo release code

}

5. Introduction of the interlayer data, when a function needs to return the entity by Keyfield through an entity, it should be the keyfield of the entity; when an entity is added or updated, An example of passing the entity.

6. Definition of logical layer rule

to be continued...

转载请注明原文地址:https://www.9cbs.com/read-25361.html

New Post(0)