c# - .NET OData Web api -


i have 2 ways use model generated entity framework. can not find use when , why.

  1. method 1

     odataqueryoptions<key_result> options (passed function argument)   private odataquerysettings settings = new odataquerysettings();   iqueryable<key_result> result;             try             {          result = options.applyto(dataaccessfunction.key(keyids), settings) iqueryable<key_result>;              } 
  2. method 2

            iqueryable<log> result;          try         {             result = accessmodel.log;          } 

so far, have used them in code without knowing correct or why both used. can't find material me too.

also, first 1 using in odata endpoints created using table valued functions in sql while second 1 using endpoints created using simple tables , views.

but if entity framework consistent, shouldn't matter. , should able use 2 approaches interchangeably. can used interchangeably, difference makes them preferred 1 situation (table valued function) , not preferred other 1 (tables, views).

both can used both have different uses. if settings parameters such null propagation, stable sort or page size have set use method 1.

however, setting page size etc. done without this. method 2 simplest not handle page sizing or null propagation etc.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -