In case you drop by here. Do check out my new blog site at http://patrickyong.net
I will stop posting at this side.
In case you drop by here. Do check out my new blog site at http://patrickyong.net
I will stop posting at this side.
Awhile ago I blogged about Microsoft releasing products protocol documentation which are essential design specifications. That was about 2 months ago and the documents are of beta version.
Today the official version 1 is out that it covers the following products.
Base on the idea behind the Issue Tracker project in www.asp.net, I am developing a new version with the intention of
I got the help of Poh Sze and Ervin to help me on part of the project and I hope to showcase it in Tech.Ed SEA 2008.
There seem to be quite a lot of questions in forums and blog post about inability of have LINQ to SQL object in a Workflow Foundation’s Activity execution. Most of the time, you will end up getting a error message as below
Type ‘System.Data.Linq.ChangeTracker+StandardChangeTracker’ in Assembly ‘System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ is not marked as serializable.
After I did some research and found out about serialization method in LINQ to SQL here:
http://msdn.microsoft.com/en-us/library/bb386929.aspx
Code generation in LINQ to SQL supports DataContractSerializer serialization. It does not support XmlObjectSerializer or BinaryFormatter. For more information, see Serialization (LINQ to SQL).
However for Workflow Foundation, it is using BinaryFormatter to serialize objects into persistent layer (refer the MSDN document here)
When the workflow runtime encounters a persistence point during workflow instance execution, it calls the persistence service to do the work. The persistence service will then serialize the workflow state into a stream using BinaryFormatter serialization, optionally compress it, and save it into a durable store.
As such there is a crash here which renders LINQ to SQL entities can’t be used in Workflow Foundation. Fortunately Serena Yeoh found a solution and put it into her project at Layer Sample. You can found out more at this forum thread. Basically her code will take LINQ to SQL objects, clone it and serialize it using DataContractSerializer first before committing changes. Then after that it will return the cloned copy.
Call it layered of n-tier also can, Serena Yeoh aka Firedancer who now works in Microsoft Consulting Services came out with a sample application based on the whitepaper – Application Architecture for .NET: Designing Applications and Services.
It is hosted at Codeplex and now at its 4th release. Besides demo how to built enterprise level application using .NET, it also features new cutting edge .NET 3.5 technologies such as LINQ, WPF, WCF and WF. By basing on the best practices of the MSDN Architecture whitepaper, this Expense Sample app also showcase and helps you to jumpstart SOA and S+S based architecture.
Again, here is the link
Using the latest materials from Ervin to teach Getting Started with .NET for Start.NET program today at MCSB training center at Island Plaza, Penang. The first shock early morning is almost all the Visual Studio 2008 installation complain about trial expiration. I taken about 2 hours to figure out actually some itchy hands changed the system date of the training PC back to year 2007, thus triggering the VPC to complain about expiration.
Finished 4 out of 8 labs today and materials from Ervin are generally good and easy to understand but I realize a few places where it will do good to have some extra explanation. So on the spot during the training, I came out with a PPTX of about 7 slides to give examples on Object Oriented programming concept.
You can download it from SkyDrive here.
I am out of KL for this week and will be running some workshops and talks at Penang.
This coming Monday and Tuesday I will conduct a Getting Start with .NET programming workshop at MCSB Training Center at Island Plaza. With the help of my pal Ervin Loh, he updated the content of the workshop to use latest features from .NET Framework 3.5 and hands on labs are using Visual Studio 2008. My colleague Rahimah will also be running similar workshop at Cyberjaya at the same place.
After that on next Thursday I will do a What’s new with Visual Studio 2008 talk at Penang Skills Development Center, expect something cool to be demo.
In my previous post I discovered that Content Controls in WordprocessingML files which has data binding to a CustomXML part will not render properly. However, this ONLY apply if you programmatically replaces the CustomXML part but never modify the value of <w:t> within the <w:sdt> element just like in this Eric White’s video on YouTube or as per mentioned in the book [Pro SharePoint Solution Development] in Chapter 7 .
To make things clearer, lets look at the screen shots below. For a Word 2007 document with CustomXML data bound(AND also with the CustomXML modified programmatically), below is what it looks like by default when you open it with Office 2003 (or XP and 2000), the data does not appear (below).
Even though you see there is no problem when open it up with Office 2007 (below)
This is because the Compatibility Pack for Office 2007 File Format does not render the value data bound inside the <w:databinding> element but instead its take the value in <w:t> element, shown below:
<w:sdt>
– <w:sdtPr>
<w:dataBinding w:xpath=”/root[1]/name[1]” w:storeItemID=”{b6aa39be-c6d5-40ca-a66e-93dbd069104f}” />
<w:id w:val=”3411243″ />
– <w:placeholder>
<w:docPart w:val=”DefaultPlaceholder_22675703″ />
</w:placeholder>
<w:showingPlcHdr />
<w:text />
</w:sdtPr>
– <w:sdtContent>
– <w:p w:rsidR=”006D15FD” w:rsidRDefault=”00F43988″>
– <w:r w:rsidRPr=”00583873″>
– <w:rPr>
<w:rStyle w:val=”PlaceholderText” />
</w:rPr>
<w:t>Click here to enter text.</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
So I created a generic project using the latest OpenXML SDK (April 08 CTP) and together with LINQ to XML to modify the content within <w:t> element with the value from the CustomXML part. You can download my full source code here, but basically this is how my solution works:
XNamespace w = @”http://schemas.openxmlformats.org/wordprocessingml/2006/main”;
public void Convert(string fileName)
{
using (var wordDoc = WordprocessingDocument.Open(fileName, true))
{
var mainPart = wordDoc.MainDocumentPart;
XmlReader reader;
reader = XmlReader.Create(mainPart.GetStream(FileMode.Open, FileAccess.Read));
XDocument mainXml = XDocument.Load(reader);
string xpath;
XElement t;
var bindings = mainXml.Descendants(w + “dataBinding”);
This is where the magic works, grab XPath attribute value from all the <w:databinding> elements and then replace it into <w:t> element using GetValueFromCustomXmlParts method (details do refer my source code)
foreach (XElement binding in bindings)
{
xpath = binding.Attribute(w + “xpath”).Value.ToString();
t = binding.Parent.Parent.Descendants(w + “t”).First();
string textValue = GetValueFromCustomXmlParts(mainPart.CustomXmlParts, xpath, myns);
t.ReplaceNodes(textValue);
}
XmlDocument temp = new XmlDocument();
temp.Load(mainXml.CreateReader());
temp.Save(wordDoc.MainDocumentPart.GetStream(FileMode.Create, FileAccess.Write));
}
}
After that the Word 2007 document can be opened in Office 2003 and data are rendered successfully. This solution also works in other none-MS Office productivity suites such as ThinkOffice and WordPerfect.
Disclamer: This is just a quick fix or rather a proof of concept on how to solve the <w:databinding> element problem on a simple Word 2007 document, there are many situations (or more complex document layout) I haven’t tested the solution on. Do download my solution at your own risk. If you bump into problems do let me know, but my help will only be on best effort basis.
By the way, here is Eric’s video on the new OpenXML SDK
[YouTube=http://www.youtube.com/watch?v=t_FYHd234ng]
YouTube – Open XML SDK demo and road map
DinnerNow is a cool sample application that is complex and huge enough to showcase all the latest Microsoft Windows Application Platform technologies. It is also a good example on how to put Software plus Service vision to work here. You can download the latest v2.5 version from Codeplex website.
Not I want to do selling here but the technologies includes
Because of IIS 7.0, you will need to install DinnerNow on top of Windows Vista or Windows Server 2008. However since trying this for the past few months, I got no luck of getting it running. There has been quite a few posts on the Codeplex forum with people complaining the same time.
Then checking back all the event logs in the OS, I realize there are a lot of authentication error in the IIS log. This leads me to a creation the self signed SSL cert causes this problem. This is because when you setup the WCF service website of DinnerNow it will installs its own SSL cert as well. So for a change I created a clean Win Server 2008 VPC and during the IIS installation process, I refused to create or install any SSL cert. Just select Choose a certificate for SSL encryption later in the Choose a certificate for SSL encryption screen (as pic below)
Well, do check out whether this work for you or not which I believe there are other environment issues which might pops up for larger application like DinnerNow.
P/S: So to get DinnerNow working on my VPC, I installed the following software
Visual Studio 2008 together with .NET 3.5 was released about 1/2 year ago. However there are a host of planned features not able to make it to the release, for example:
Then not long ago I got news that another new .NET features will make it to this SP1 release which is the .NET 3.5 Client Profile. Well, Windows Vista comes with .NET 3.0 but the world out there is mostly running Windows XP which does not have any.NET Framework installed at all! (unless you are a geek head). The .NET Framework 3.5 Client Profile (BETA) contains a subset of features contained in the full installation of the .NET Framework. The subset of features are the Common Language Runtime, ClickOnce, Windows Forms, Windows Presentation Foundation and Windows Communication Foundation. Hollay!! Consider the fact that full .NET 3.5 requires .NET 2.0 and 3.0 installed then those 2 package already take up >100mb of downloads. You can check out Scott Guthrie’s blog here. http://weblogs.asp.net/scottgu/archive/2008/02/19/net-3-5-client-product-roadmap.aspx
The Beta bits is available as a web install but there was ways for you to download everything and save them locally. Check out this knowledge base article. http://support.microsoft.com/kb/945140
There are a few KB articles out there listing down all the changes
You can download the bits here