Search This Blog

Sunday, July 10, 2011

Using Jquery and/or JqueryUI? Get better Performance this way...

Always use JQuery / JQueryUI javascript API from a CDN. This gives better performance for your application specially if it is on Internet. Since some of these large CDN have caches and are available throughout the world acessing these .js files is faster than storing them in your local network. It also saves bandwidth for your local network.

Here are the links:

Microsoft CDN: This page below contains links for all Jquery versions on MS CDN.

http://www.asp.net/ajaxlibrary/cdn.ashx


Here is for Google:

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js" type="text/javascript"></script>

The query uses unsupported elements, such as references to more than one list, or the projection of a complete entity by using EntityRef/EntitySet."}

"The query uses unsupported elements, such as references to more than one list, or the projection of a complete entity by using EntityRef/EntitySet."}
System.SystemException {System.InvalidOperationException}"

While using LINQ to SharePoint if you get this exception the possible reason is:

a) The LINQ query is using Except or Union or any possibly other operator/function (another example - Join) that performs action on two or more LINQ queries.

I recently encountered this while using Except and Union.

Cause: SharePoint tries to convert these into CAML queries but there are no equivalents in CAML. Hence the above error is generated.

Example
var result1 = from x in dataContext.SharePointList where ....

var result2 = from...

var resultFinal = result1.Union<DataClass>(result2)

The above statement resultFinal would result in this error.

Solution: use ToList before using such function / operation:

var resultFinal = result1.toList<DataClass>.Union<DataClass>(result2.toList<DataClass>)

i.e. before Union - convert to a list using ToList which will avoid CAML generation for Union internally.