c# - Why is this caught in running time? -


what problem following code?

var results = db.departments.select(x => customfunction(x.departmentid)); results.tolist(); 

why this not caught in compile time gives exception in runtime?

there many different linq providers allow use linq against variety of data sources (linq entities, linq objects, linq xml among others).

although linq entities not know how invoke custom method (at least, not providers common databases), linq providers might understand how execute myfunction. compiler not integrated of many linq providers, information whether custom method can included available @ runtime.

in fact, linq objects can execute it

var results = db.departments               .asenumerable()               .select(x => myfunction(x.departmentid)); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -