Recently I want to use nhib.pdf to write a quick development framework.
When paging is implemented, you want to use the paging query method of nhib.pdf, but you do not know its paging principle.
Mainly database paging or false paging, which has a great impact on performance. Confirm.
However, after show_ SQL = true is configured, the generated SQL script cannot be seen.
It seems that log4net must be configured.
Later I found an article. Http://zhouweigang01.blog.163.com/blog/static/9340907201223093637530/
Introduced an excuse, very good, very reliable.
Therefore, we used this method to perform a tracking and found that it is indeed a database paging. Although rownum is used, the performance is generally enough.
Paste the Code:
Using system; using system. collections. generic; using system. LINQ; using system. text; using nhib.pdf. sqlcommand; namespace Dao {[serializable] public class emptyinterceptor: iinterceptor {// n lines of code earlier are omitted Public Virtual sqlstring onpreparestatement (sqlstring SQL) {return SQL ;} public void aftertransactionbegin (itransaction Tx) {// throw new notimplementedexception ();} public void after Transactioncompletion (itransaction Tx) {// throw new notimplementedexception ();} public void beforetransactioncompletion (itransaction Tx) {// throw new notimplementedexception ();} public int [] finddirty (Object entity, Object ID, object [] currentstate, object [] previusstate, string [] propertynames, nhib.pdf. type. itype [] types) {// throw new notimplementedexception (); return NULL;} public obje CT getentity (string entityname, Object ID) {// throw new notimplementedexception (); return NULL;} Public String getentityname (Object entity) {// throw new notimplementedexception (); return "";} public object instantiate (string entityname, entitymode, Object ID) {// throw new notimplementedexception (); return NULL;} public bool? Istransient (Object entity) {// throw new notimplementedexception (); Return true;} public void oncollectionrecreate (object collection, object key) {// throw new notimplementedexception ();} public void oncollectionremove (object collection, object key) {// throw new notimplementedexception ();} public void oncollectionupdate (object collection, object key) {// throw new notimplementedexception ();} public void ondelete (Object entity, Object ID, object [] State, string [] propertynames, nhib.pdf. type. itype [] types) {// throw new notimplementedexception ();} public bool onflushdirty (Object entity, Object ID, object [] currentstate, object [] previusstate, string [] propertynames, nhib.pdf. type. itype [] types) {// throw new notimplementedexception (); Return true;} public bool onload (Object entity, Object ID, object [] State, string [] propertynames, nhib.pdf. type. itype [] types) {// throw new notimplementedexception (); Return true;} public bool onsave (Object entity, Object ID, object [] State, string [] propertynames, nhib.pdf. type. itype [] types) {// throw new notimplementedexception (); Return true;} public void postflush (system. collections. icollection entities) {// throw new notimplementedexception ();} public void preflush (system. collections. icollection entities) {// throw new notimplementedexception ();} public void setsession (isession session) {// throw new notimplementedexception () ;}} public class myinterceptor: emptyinterceptor {public override nhib.pdf. sqlcommand. sqlstring onpreparestatement (nhib.pdf. sqlcommand. sqlstring SQL) {console. writeline (SQL. tostring (); Return base. onpreparestatement (SQL );}}}
Onpreparestatement can be rewritten in multiple ways. Here, console. writeline is the output console. In fact, I checked it through debug.
Of course, you can also write TXT text records.
Above