max entries:
2009-12-15
Entity Framework Dynamic Data IssuesNoodling around with Entity Framework and more specifically using it for ASP.NET Dynamic Data. By default if you have table(s) with a primary key column using "identity" for key generation. The insert/update views rendered by the Dynamic Data pages will show edit controls for your keys! This is a issue bug, but here is a fix. See http://forums.asp.net/t/1306469.aspx, and more specifically this blog entry for possible fixes. In my specific case I needed to add an attribute to the generated entity class as follows (note the ScoffoldColumn attribute). By the way, do this in a separate partial class file if you don't want to lose the change on regeneration of your model /// <summary>
/// There are no comments for Property Id in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
[global::System.ComponentModel.DataAnnotations.ScaffoldColumn(false)]
public int Id
{
get
{
return this._Id;
}You'll also want to make note that even though Entity Framework supports many to many relationships (sorta), that Dynamic Data for VS2008 SP1 does not. This blog entry claims a solution. I need to dig into it yet. 2009-12-09
Interesting articles on Entity Framework, and AJAX Accordian Control DataBindingHere's a couple of links to articles that I've read recently that I found interesting or noteworthy...
2009-11-20
Installing Reporting Services on Windows 7, Vista or Windows Server 2008As usual I'm in the never ending process of expanding my knowledge of Microsoft Technology. Today its SQL Server 2008 Reporting Services. I've noodled around with Reporting Services in 2005 back in the days of running XP and it was all pretty easy to install/configure (even without reading the docs). However now I'm on Windows 7 and have run into a problem. Running everything (IE and Visual Studio) seems to help. I ran across this post which offers some alternatives. 2009-11-12
SharePoint 2010 Developer TrainingChannel 9 has launched SharePoint 2010 Training and Office 2010 online training courses.
From the "Developer Roadmap" Section...
2009-11-02
Creating A Custom Store Locator for Commerce Server 2009Ran across this blog entry for a custom store locator solution for Commerce Server 2009. Another add to my Commerce Server 2009 ToDo List. 2009-10-30
Commerce Server 2009 CSExtentionsRan across an independently developed WebPart for adding new items to the catalog. On my todo list to investigate. 2009-10-07
Commerce Server 2009 XSLT Web PartsMany of the web parts that come as part of the SharePoint Commerce Services are based on XSLT transforms. This approach provides Commerce administrators the ability to change the rendering of a web part without the code change, recompile and re-deploy cycle. You can see what any given XSLT looks like by browsing to one of the pages within the SharePoint Commerce Services Default Site that utilizes an XSLT based web part. Take the Category page for example. By default this page, which uses the Category.aspx template, includes the Product Query Web Part. When placing the page and the web part into edit mode, the browser renders a drop list control titled “Template to Display”.
This control allows the administrator/editor to select an XSLT to apply the data returned from the Commerce Catalog. You can actually see the XSLT by clicking on the ellipses button “…” in the next control below titled “Template Details”.
Below the “Template Details” control is a third titled “Template Properties”. Clicking the “Select Properties…” button opens a popup window which allows one to select what product properties, including variant properties will rendered by the web part.
By changing the properties that are to appear, you are actually modifying the XSLT. You just click away and the underlying web part editor takes care of modifying the XSLT source. You can even save your modifications to another “template” so as to avoid modifying the out of the box “templates”. Note that I say “template” as opposed to saying ”XSLT”. I say “template” because what you are saving is not just an XSLT. A Commerce Server Web Part “template” has an XSLT within it that is used to transform XML into an HTML rendering, however there is more to a “template” than just the XSLT. If you navigate to the “Commerce Server Templates” list you can view the available templates, including any that you may have modified and saved to a different name.
When you click on one of these within this SharePoint list the browser will launch Notepad so that you can take a look at what is contained in these so called “templates”. I suggest that you open one up and take a look. You’ll notice (or at least I did), two interesting thing about this so called “template” document. The first is what while you can see the XSLT within the document, it is prefixed with some other XML content. In the DefaultSite_ProductQuery.template for example, you’ll see that the file begins with <?xml version="1.0" encoding="utf-16"?>
<template>
<productProperties>
<property Name="DisplayName" />
<property Name="Id" />
<property Name="Image_filename" />
<property Name="ListPrice" />
<property Name="Description" />
</productProperties>
<variantProperties>
<property Name="DisplayName" />
<property Name="Id" />
<property Name="ListPrice" />
</variantProperties>
<productDefinition>
</productDefinition>
<xslTransform>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">These XML elements are used by the WebPart editor to keep track of what Product properties, Variant properties etc. are currently configured for rendering within the transform. Much of this is handled by the class XsltTemplateEditorPart class. The second thing I noticed is a non-standard element within the XSLT portion of the transform. This is the <<XsltAction> element. <XsltAction Id="AddToCart"
Type="Microsoft.Commerce.Portal.UI.Catalog.WebControls.VariantAddToCartXsltAction, Microsoft.Commerce.Portal.UI.Catalog, Culture=Neutral, Version=1.0.0.0, PublicKeyToken=942403bb93c53277">
<ConfigSettings>
<ConfigSetting Name="ProductId">
<xsl:value-of select="property[@name='Id']" />
</ConfigSetting>
<ConfigSetting Name="DisplayAddToShopperList">true</ConfigSetting>
<ConfigSetting Name="AddToShopperListDefault">false</ConfigSetting>
<ConfigSetting Name="ImageButtonUrl"></ConfigSetting>
</ConfigSettings>
</XsltAction>If you dig through the source of the Commerce Server Extensibility kit you’ll learn that during rendering of the web part, in this case the Product Query Web Part, after the Commerce Server Catalog data is retreived, converted to XML and the XSLT portion of this “template” is applied, this <XsltAction> element is turned into something else. The RenderXsltActions method of the ProductQuery web part class performs this action. This method, with the help of the XsltActionHelper class, finds all occurrences of <XsltAction> nodes within the XSLT transform results. It uses the element and its attributes to instantiate the specified web control and then have the control instance render its contents to a StringBuilder. String class Replace method is then used to replace the <XsltAction> element within the XSLT transform results. The outText parameter is the result of the XSLT already applied to the XML. Below is the relevant code fragment: protected string RenderXsltActions(string outText)
{
Collection<XsltAction> xsltActions = XsltActionHelper.GetXsltActions(outText);
int controlIndex = 0;
foreach (XsltAction action in xsltActions)
{
Type xsltActionType = Type.GetType(action.ClassType);
if (xsltActionType == null)
{
throw new XsltActionException("Cannot instantiate XSLT action " + action.Id);
}
XsltActionControl control = Activator.CreateInstance(xsltActionType) as XsltActionControl;
try
{
string controlUniqueId = this.UniqueID + "$" + action.Id + controlIndex.ToString(CultureInfo.InvariantCulture);
control.Initialize(controlUniqueId, this.GetProductContext(), action.ConfigSettings, this.Page.ClientScript.GetPostBackClientHyperlink(this, controlUniqueId));
StringBuilder sb = new StringBuilder();
control.RenderControl(new HtmlTextWriter(new System.IO.StringWriter(sb, CultureInfo.InvariantCulture)));
outText = outText.Replace(action.TagSnippet, sb.ToString());
controlIndex++;
}
catch (XsltActionException)
{
throw;
}
}
return outText;
}This resulting string is then used to actually render the web part within the RenderContents() method. While this seems complex and “round about”, it provides a level of flexibility that would not be possible otherwise. 2009-09-29
Commerce Server 2009 Development on Windows 7?I've run across a couple of web articles that seem to suggest that it may be possible to do Commerce Server 2009 development, including SharePoint Commerce Services development on a pc running Windows 7. I've not tried this yet, but I may at some point. The relevent links are below: proceed at your own risk 2009-09-22
Manual Deployment of SharePoint Commerce ServicesI've been struggling a bit lately with the Manual Deployment of SharePoint Commerce services. While I posted to the CS2009 newsgroups, I received no help; eventually I figured it out myself. The crux of the problem lies in the Microsoft Commerce Server 2009 Installation and Configuration Guide which IMHO could use come clarification in a couple of different places. The first problem is with step 9 on page 88 which suggests that you can access your newly created SharePoint Web app without having created a site collection. While I'm no SharePoint expert (yet), my local SharePoint cohorts suggest that without creating a site collection on the site, you cannot access http://localhost:port/Pages/default.aspx/ without observing a 404 error which is exactly what I observed. In the Microsoft Commerce Server 2009 Installation and Configuration Guide the step of creating a site collection comes much later so I think that this is just out of order issue. In any case, I went ahead and created a site collection after creating the web site and app and them am able to access http://localhost:port/Pages/default.aspx such that I can continue on with step 10 to set anonymous access to the entire web site. The next problem comes in step 5 on page 91. Step 5 suggests that you "activate all features whose names begin with Commerce Server in the Web application where you deployed the Web Parts". Step 5 pertains to when when you are deploying the Web Parts only and if you attempt to activate features that are specific to the Default Site it only results in errors and head scratching. Activating "Default Site" features is wrong and will cause errors. Only activate those feature which do not have "Default Site"in their name. Perhaps the the best way to see what should and should not be activated is to perform a wizard deployment of web parts only and see what features are activated. 2009-09-21
Commerce Server 2009 Product Query via IronPythonI again lifted some code from a blog entry titled "Using Commerce Server 2009 outside of a Web Application". Rather than trying to do something with the Order sub-system, I decided to amuse myself by porting this product query to IronPython. Porting it was very straight forward as long as you are familiar with Python and know how to port the IronPython specific things (importing the clr, adding references, IronPython syntax for .NET generics, etc.). The trick is knowing how to bring in the app.config and the ChannelConfiguration.xml, and MetadataDefinitions.xml). I confess I stole this info too from this posting on the IronPython mailing list.. In a nutshell since ipy.exe, IronPython, is the host, you supply your app.config through ipy.exe.config and just place the other files in the same directory as your executable. 1 import clr
2 import System.AppDomain
3
4 clr.AddReference("Microsoft.Commerce.Application.Common")
5 clr.AddReference("Microsoft.Commerce.Broker")
6 clr.AddReference("Microsoft.Commerce.Common")
7 clr.AddReference("Microsoft.Commerce.Contracts")
8 clr.AddReference("Microsoft.Commerce.Providers")
9
10 from System.Threading import Thread
11 from Microsoft.Commerce.Contracts.Messages import CommerceRequestContext
12 from System import Guid
13 from Microsoft.Commerce.Common import OperationServiceAgent
14 from Microsoft.Commerce.Common.MessageBuilders import CommerceQuery
15 from Microsoft.Commerce.Contracts import CommerceEntity
16
17 rq = CommerceRequestContext()
18 rq.UserId = Guid.NewGuid().ToString("B")
19 rq.Channel = "Default"
20 rq.UserLocale = Thread.CurrentThread.CurrentCulture.Name
21 rq.UserUILocale = Thread.CurrentThread.CurrentUICulture.Name
22 rq.RequestId = Guid.NewGuid().ToString("B")
23
24 query = CommerceQuery[CommerceEntity]("Product")
25 query.Model.Properties.Add("Id")
26 query.Model.Properties.Add("DisplayName")
27 query.Model.Properties.Add("Description")
28 query.Model.Properties.Add("ListPrice")
29 query.SearchCriteria.Model.Id = "AW099-15"
30 query.SearchCriteria.Model.Properties["CatalogId"] = "Adventure Works Catalog"
31
32 osa = OperationServiceAgent()
33 responses = osa.ProcessRequest(rq, query.ToRequest())
34 response1 = responses.OperationResponses[0]
35 product = response1.CommerceEntities[0]
36
37 print product.Properties["Id"]
38 print product.Properties["DisplayName"]
39 print product.Properties["Description"]
40 print product.Properties["ListPrice"]
The output is... of course C:\Program Files\IronPython 2.0.2>ipy cs2009.py AW099-15 Venus Hinged crampons for snow and moderate ice, step-in bindings, one size fits men's 4-12. 99.0000 C:\Program Files\IronPython 2.0.2>
Compiling the CS2009 Extensibilty Kit (aka the source code for "SharePoint Commerce Services")A couple of tips:
2009-09-14
What's New in .NET 4.0Ran across a nice overview article on .NET 4.0. See MSDN Article "What's New in the .NET Framework 4 Base Class Library provides an overveiw of what is new in .NET 4.0. Interesting stuff coming down the pipe. Its nice to see that Microsoft is trying to catch up with features with features like lamda's (.NET 3.5) and tuples [.NET 4.0] that other from other languages/platforms like Python have had forever 2009-08-14
Commerce Server 2009 Orders System Development without a Web AppI'm working on a project where a local team is responsible for developing some custom operational sequence components. This team is not co-located with the remote team performing the main web development which has a their own source development repository. Because the teams and source repositories are split, it is difficult to utilize the main web app as the host process for the operational sequence component development effort. I recently ran across a blog entry titled "Using Commerce Server 2009 outside of a Web Application" which provides an explanation and some sample code how to execute a product query against a Mojave catalog with a simple console application. Since several of the targeted operational sequence components need to execute against the Mojave “Basket” entity, extensions to this sample are needed to get Mojave operations to successfully execute. I thought if this could be extended to support the orders system, using console applications, or perhaps even unit test projects, would be an ideal way to provide a host process for the operational sequence component effort. For each pipeline configuration file that is already configured in the application channelconfiguration.xml file, additional entries to the <pipelines> section under <ServiceConfiguration><Sites><site> section is needed. The following should be added so that Mojave, running as a console application, can find the relevant pipeline configuration files: <pipeline
name="basket"
path="pipelines\basket.pcf"
transacted="false"
type="OrderPipeline"
loggingEnabled="false" />
<pipeline
name="total"
path="pipelines\total.pcf"
transacted="false"
type="OrderPipeline"
loggingEnabled="false" />
<pipeline
name="checkout"
path="pipelines\checkout.pcf"
transacted="false"
type="OrderPipeline"
loggingEnabled="false" />Like wise a folder named “pipelines” containing the files basket.pcf, total.pcf, and checkout.pcf should be added to project. These pipeline configuration files can be found as part of the Commerce Server install under C:\Program Files\Microsoft Commerce Server 2007\Pipelines. Once this console application host is established, the appropriate Mojave Basket entity operations (query, update, delete) can be involved via the Mojave API, which will result in success execution of the out of the box operational sequence components for the Orders sub-system including those which execute the legacy pipeline configuration files (*.pcf) and their pipeline components. Turning on pipeline logging verifies the fact that these components are executing. Once this is established one can add your own custom operational sequence components, plug in the configuration for for the message handler elements in the channelconfiguration.xml file and have them execute, debug them, whatever needed. 2009-07-31
Obtaining the Public Key Token for Strongly Named AssembliesHere is a handy way to integrate the strong named assembly utility into visual studio for obtaining the public key token of a string named assembly. 2009-05-26
PyCon 2009 Conference VideosStumbled across this the other day. Some stuff to watch in your spare time. 2009-04-29
Getting Started with Python/MoinMoin DevelopmentI subscribe to the MoinMoin users mailing list and read an useful post by Thomas Waldmann who is one of MoinMoin's main contributors. I thought I'd share it: > 2. I am new in Python and I want to learn how to develop the MoinMoin. Some more infos about moin: http://moinmo.in/MoinDev http://moinmo.in/CodingStyle http://moinmo.in/MoinMoinChat To begin with moin coding, I suggest you look at moin macro coding first. It is quite easy and you do not need much experience for it. Later try actions, then parsers and themes, and finally hack the moin core. :) For learning Python, make sure you do some tutorial (there are quite some on the web) or read a good book about it. A nice python news source and also often quite educational is planet.python.org. If you want to do serious developing, maybe also have a look at Mercurial DVCS (the version control system we use). It is very useful in general, quite some other projects use it, too. You can also use it for your own stuff locally. If your goal is developing plugin extensions and fixes, use moin/1.8 (current stable) repo. If your goal is doing bigger core changes, use the moin/1.9 (or soon moin/2.0) repo. Communicate with us often - that avoids double work or work going in the wrong direction. 2008-12-29
Virtual Tech DaysEven if you cannot attend these, they are potentially a good source for web casts. 2008-12-192008-11-09
More Effective C#Bill Wagner's new "More Effective C#" Item 1 in his book has inspired me to put togther a page on considerations for CSharpClassDesign. Its a work in progress. 2008-11-07
Mojave - next steps with Commerce ServerMicrosoft has made some announcments for their next steps and commitment to Commerce Server. You can see the PDC presentation online here. 2008-10-18
Ann Arbor Day of .NETI'm currently attending .NET of .NET in Ann Arbor. I'll be keeping notes here on my blog through out the day.
|
(Hint - click a month/year, then click a date.)
AdoDotNetDataServices AspDotNet20 Author BestPractices Biztalk CcSharp CcSharpQuiz Communications ComponentObjectModel ContentManagement DistributedTransactions DotNetConfiguration EntityFramework FreeBsd Homepage InversionOfControl LanguageIntegratedQuery Linq Microsoft MicrosoftCertification MicrosoftCommerceServer MicrosoftData MicrosoftDotNet MicrosoftServerProduct MicrosoftVirtualPc MultiTasking PageInProgress ProgrammingLanguages ProjectManagement Python SharePoint SilverLight SoftwareArchitecture SoftwareDevelopment SoftwareQuotes SoftwareTools SqlServer TestDrivenDesign Troubleshooting Unicode VersionControl VisualStudio Web WebDevelopment WebServices WindowsCommunicationFoundation WindowsForms WindowsProgramming WindowsSecurity |
has been released and is now available both