Wednesday, April 28, 2010
PRISM 4.0 P&P Features Survery
Features Survey
RockNUG: Silverlight 4 Code and Notes
On April 14, I presented an introduction to Silverlight 4 at the Rockville .NET User Group. My sample project code, along with presentation notes, are available here.
Monday, April 26, 2010
Azure team blogs and voting sites
The Azure team has several blogs announcing new features, Azure sites, integration tools, customer stories, and general platform updates:
- Windows Azure blog – visit this blog to see the latest platform updates, as well as OS updates and tools for platform integration (such as Jetty).
- SQL Azure blog – this blog is dedicated to the Azure-specific version of SQL Server. This blog will provide information around new and upcoming features such as MARS.
- Azure AppFabric blog – this blog is specific to AppFabric features such as access control, service bus, and experimental features, called AppFabric LABS.
- Azure Storage blog – this blog is dedicated to blob and table storage, including code samples and useful tools (such as the recent storage explorer tool compilation).
- Codename Dallas blog – this blog covers the latest information about the new Azure data-provider service.
Aside from blogs, the Azure team is soliciting feedback for future features. You can cast your votes and be heard here:
May 12 – Launching and Monitoring your First Azure App
Please register here if you’d like to attend.
For more information about the Azure User Group, visit the LinkedIn group page or follow AzureUG on twitter.
Sunday, April 25, 2010
Silverlight Ramp-up Resources
- Silverlight 4 Hands On Lab - Free MS Hands on lab that you can use to get started.
- Silverlight 4 using MVVM Pattern, RIA Services and Custom Domain Service - Jump right into learning MVVM pattern with Silverlight and RIA Services. In this scenario we could not use Entity so we had to understand how RIA Services work without them.
- Silverlight Custom Authentication Domain Service with RIA Services - Shows a quick way to do custom authentication services and shows how to create a domain service factory.
- Binding ComboBox and AutoComplete Controls in Silverlight DataGrid - Discuss advanced binding concepts and how to bind using column templates in a grid.
- RIA Service Domain Service Method Life-Cycle - Discusses the life-cycle of RIA Service methods.
- Silverlight Localization and Resource Files - Good references on how to utilize resources files in your Silverlight apps.
- Deep Dive into Custom RIA Service and Transactions - A deep dive in building DTOs with RIA Services and how the ChangeSet works to manage transactions.
Thursday, April 22, 2010
Windows Phone Developer Tools and Visual Studio 2010 RTM
Just a warning that if you are developing applications using the CTP of Windows Phone Developer Tools, do not upgrade to the RTM of Visual Studio 2010. The two are not compatible. You need to stay on the Release Candidate of Visual Studio 2010 until the Phone Developer Tools are updated. If you want to be notified when that happens, you can sign up to receive an email here.
Thursday, April 15, 2010
Silverlight 4 is available!
Today, Microsoft officially released Silverlight 4. As a developer, you’ll want to head over to www.silverlight.net/getstarted – you’ll find links for all needed tools:
- Visual Studio 2010
- Silverlight SDK
- Silverlight Toolkit
- Expression Blend 4 RC
Wednesday, April 14, 2010
Using an ADO.NET Entity Model Against SQL Server and SqlCE
<schema namespace="Model.Store" alias="Self" provider="System.Data.SqlClient" providermanifesttoken="2008"></schema>
<schema namespace="Model.Store" alias="Self" provider="System.Data.SqlServerCe.3.5" providermanifesttoken="3.5"></schema>
1: public class RegenerateClientSsdlTask : Task2: {
3: public RegenerateClientSsdlTask()
4: {
5: }
6:
7: public string AssemblyName { get; set; }
8: public string ProviderName { get; set; }
9: public string ProviderManifestToken { get; set; }
10: public string OutputPath { get; set; }
11: public string SsdlPath { get; set; }
12:
13: public RegenerateClientSsdlTask(ResourceManager taskResources) : base(taskResources)
14: { 15: } 16: 17: public RegenerateClientSsdlTask(ResourceManager taskResources, string helpKeywordPrefix) : base(taskResources, helpKeywordPrefix)
18: { 19: } 20: 21: public override bool Execute()
22: { 23: 24: var setup = new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(GetType().Assembly.Location) };
25: 26: AppDomain load = AppDomain.CreateDomain("Analyze", AppDomain.CurrentDomain.Evidence, setup);
27: 28: try
29: {30: var instance = load.CreateInstance(GetType().Assembly.FullName, typeof (SSDLProcessor).FullName);
31: 32: var processor = instance.Unwrap() as SSDLProcessor;
33: 34: processor.AssemblyName = AssemblyName; 35: processor.ProviderName = ProviderName; 36: processor.ProviderManifestToken = ProviderManifestToken; 37: processor.OutputPath = OutputPath; 38: processor.SsdlPath = SsdlPath; 39: 40: load.DoCallBack(processor.ProcessSSDL); 41: 42: return true;
43: 44: }45: catch (Exception)
46: {47: return false;
48: }49: finally
50: { 51: AppDomain.Unload(load); 52: } 53: 54: } 55: 56: private class SSDLProcessor : MarshalByRefObject
57: {58: public string AssemblyName { get; set; }
59: public string ProviderName { get; set; }
60: public string ProviderManifestToken { get; set; }
61: public string OutputPath { get; set; }
62: public string SsdlPath { get; set; }
63: 64: public void ProcessSSDL()
65: { 66: var assm = Assembly.ReflectionOnlyLoadFrom(AssemblyName); 67: 68: var ssdl = assm.GetManifestResourceStream(SsdlPath); 69: 70: var ssdlDoc = XDocument.Load(ssdl); 71: 72: if (ssdlDoc.Root != null)
73: {74: XAttribute providerAttribute = ssdlDoc.Root.Attribute("Provider");
75: 76: if (providerAttribute != null)
77: { 78: providerAttribute.Value = ProviderName; 79: } 80: 81: XAttribute manifestAttribute = ssdlDoc.Root.Attribute("ProviderManifestToken");
82: 83: if (manifestAttribute != null)
84: { 85: manifestAttribute.Value = ProviderManifestToken; 86: } 87: } 88: 89: ssdlDoc.Save(OutputPath); 90: } 91: 92: } 93: 94: 95: }<usingtask taskname="BuildTasks.RegenerateClientSsdlTask" assemblyfile="..\Lib\BuildTasks.dll"/>
1: <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
2: <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
3: Other similar extension points exist, see Microsoft.Common.targets.
4: <Target Name="BeforeBuild">
5:
6: </Target>
7: <Target Name="AfterBuild">
8: </Target>
9: -->
1: <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
2: <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
3: Other similar extension points exist, see Microsoft.Common.targets.
4: <Target Name="BeforeBuild">
5:
6: </Target> -->
7: <Target Name="AfterBuild">
8: <Message Text="Running SSDL Gen..." />
9: <RegenerateClientSsdlTask AssemblyName="$(TargetDir)\EvapSpec.Data.dll" ProviderName="System.Data.SqlServerCe.3.5"
10: ProviderManifestToken="3.5" SsdlPath="ES.ssdl" OutputPath="$(TargetDir)\ES.ssdl" />
11: <Message Text="Finished SSDL Gen..." />
12: </Target>
AssemblyName="$(TargetDir)\Data.dll" This is the reference containing the EDMX model. Since our project references this dll it gets copied into the ouput directory. By using $(TargetDir) we always get the output directory no matter how the project or build configuration changes.
ProviderName="System.Data.SqlServerCe.3.5" This is the provider we use in our connection string on the client
OutputPath="$(TargetDir)\Model.ssdl" This is where we want the generated ssdl file to live. In order to simplify we write the file to where the client assembly lives. This is important as we have to update the connection string on the client to match.
Now to update the consuming application. Once we have the task configured we run a build and should see the SSDL file in the output directory. Lets update the app.config file to utilize it. If you haven't already copy the existing entity connection from your data project. It should look like this:
<add name="ModelEntities" connectionstring="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=(local);Initial Catalog=Model;Integrated Security=True"" providername="System.Data.EntityClient"/>
<add name="ModelEntities" connectionstring="metadata=res://*/Model.csdl|Model.ssdl|res://*/Model.msl;provider=System.Data.SqlServerCe.3.5;provider connection string="Data Source=Model.sdf"" providername="System.Data.EntityClient"/>
In doing all this we now have a common business layer that can leave on the client or the server that is capable of using the same entity model queries.
Tuesday, April 13, 2010
Azure: Staging and Compute-Hour Metering
Production and Staging
When deploying to Azure, you have a choice between Production and Staging:This comes in handy when upgrading your application. Let’s say you have an application already in Production, and you now have a new version you’d like to upgrade to. You can deploy that new version to a separate Staging area, which provides you with a separate “test URL” as well as any worker and web roles your application needs. You can run this app just like you’d run your production app. When you’re done testing, swap staging and production. This is effectively a Virtual IP address swap, so your end-users simply see an upgraded application as soon as you choose to execute the swap.
This is a terrific feature, allowing you to test an application without service disruption. It also allows you to quickly swap back to the previously-deployed version if something go wrong after deploying your new version to production.
Once you’re sure your new version is working ok, consider deleting your service from Staging. Be aware that your staging area is also consuming virtual machine instances. Staging instances and Production instances are equivalent: Each instance is a Virtual machine; Staging instances are billed just like Production instances. If you leave your service deployed to both Production and Staging, you will be accruing Compute-Hour charges for both. Just keep this in mind when estimating your monthly Azure costs.
How the hour is metered
As each application is deployed, its virtual machines are created. The moment those virtual machines are in place, metering begins. This includes stopped services. For instance: assuming we clicked Deploy on the Production area of our service, and uploaded an application comprising one worker role and one web role, we’d then see our deployment in a stopped state:At this moment, the billing clock begins for each of the instances, and billing is based on a 60-minute window: If you deploy at 4:16pm, your 60-minute window is from 4:16pm to 5:16pm (it’s not 4pm-5pm). In this example, I have two roles, with a combined consumption of 2 compute-hours per clock-hour.
If I decide to stop either of these roles before the entire hour is consumed, it’s still metered for the full hour.
Multiple Deployments in a Clock-Hour
Let’s say I delete my deployment after only 5 minutes. And then I decide to deploy again to Production. At this moment, the clock starts again for my new deployment. Using our sample app above, with one worker role and one web role:- Deploy to Production at 4:16pm, delete deployment at 4:21pm. Compute-hours billed: 2
- Deploy again to Production at 4:25pm, delete deployment at 4:30pm. Compute-hours billed: 2
- Total clock time: 14 minutes. Total compute-hours: 4
- Each instance is metered from the moment it comes to life in a Virtual Machine.
- Compute-hours are rounded up to the nearest hour. So a service is metered at 1 compute-hour, whether it runs for only 5 minutes or 59 minutes.
- Services deployed within the same clock-hour are completely unrelated, billing-wise. If you stop and delete your application and then deploy it again, all within the same clock-hour, you will still be billed separately for each deployment.
Wednesday, April 7, 2010
Azure: New Guest OS 1.2
On April 5, Azure Guest OS 1.2 became available. If you’ve published any new Azure services in the past day or two, your new deployments are probably using v1.2. In the Azure Portal, take a peek at the service configuration:
So: what does v1.2 have?
- HTTP dynamic compression for webroles
- Updates to the IIS URL Rewrite module
- .NET 4 RC
- Security patches
Ooh - .NET 4 RC??? Does that mean we can now deploy .NET 4 RC builds to Azure??? Well… Not yet. The Azure 1.1 SDK only supports .NET 3.5 build output. If you try changing your role’s target framework to .NET 4, you’ll get an error:
The .NET 4 RC framework is installed for compatibility testing. According to this MSDN article about Guest OS 1.2, there’s a known issue with unversioned performance counters.
This is a good sign though! April 12 is the Release-to-manufacturing (RTM) date for .NET 4. At MIX earlier this year, the Azure team announced that we’d see .NET 4 support within 90 days of RTM. Hopefully, having this new guest OS will help accelerate testing and bring that date closer to April 12. That also means you should send the Azure team any feedback you have regarding issues with the new Guest OS.

