LINQ to SQL and SQL Server Session State – Unable to serialize the session state
Just realize one problem with LINQ to SQL
Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in ‘Custom’ mode.
When you have your ASP.NET session state stored in SQL Server, when you put any instance of your LINQ to SQL object into the session, you will hit by the about stated error.
I am still working on a fix for this. Will post the solution here once I found it.
Getting ready for MVP Summit
Flying off tonight to Seattle for MVP Summit. So stay tuned for more blog posts after I am back. People always tell me you’ll get motivated in MVP Summit besides knowing the latest stuff, so here I come.
On the mean time, some news I found out today about Microsoft going to release a cheap Windows Server SKU for cheap USD500 hardware. Good and exciting move in challenging times like now. I do hope it will comes with .NET Framework installed.
We need that to counter the LAMP stack.
But the news article also noted that Office 14 won’t out by 2010. I am not surprise given the lack of a beta build in the wild.
Random results from LINQ to SQL
A lot of applications would like to return random results from database. For example an web ad engine that returns random ads from its database based on certain conditions.
To do this in LINQ to SQL you need a bit of programming in T-SQL because LINQ does not have a Random operator nor you can use System.Random in LINQ statements.
Fortunately, LINQ to SQL lets programmers expose their functions and stored procs as methods. So what we can do is create a view first:
CREATE VIEW RandomView
AS
SELECT NEWID() As ID
Then after that you create a function:
CREATE FUNCTION GetNewId
(
)
RETURNS uniqueidentifier
AS
BEGIN
RETURN (SELECT ID FROM RandomView)
END
In the LINQ to SQL Designer, drag and drop the function into the designer (pic below)
From your LINQ query you can then write something like this
var tools =
from tool in db.Tools
orderby db.GetNewId()
select tool.Name;
Many thanks to Fabrice for his post here.
http://weblogs.asp.net/fmarguerie/archive/2008/01/10/randomizing-linq-to-sql-queries.aspx
Solution package development tool comparisons
Just came across this post on comparison of VSeWSS, WSP Builder, STSDev, and SPSource all which try to assist SharePoint develoopers to package their solution into WSP file for deployment. Each has it’s pros and cons so you can use this as reference to pick your choice.
http://www.sharepointdevwiki.com/display/public/Solution+package+development+tool+comparisons
Visual Studio Extension for Windows SharePoint Services 1.3 CTP updated
Senior Product Manager Paul Andrew from the SharePoint team announced the availability of the VSeWSS version 1.3 yesterday.
You can get it here.
I will post more about this when I have done my testing.
On the mean time Soma Segar is releasing more info about out-of-the-box SharePoint development support in Visual Studio 2010. http://blogs.msdn.com/somasegar/archive/2009/02/19/sharepoint-tools-support-in-visual-studio.aspx
