Tony Testa posted on December 30, 2007 04:47

I HIGHLY recommend that you download the following ASP.NET Dynamic Data Intro screencast and check it out.  I just watched it and it looks really easy/powerful.  In a nutshell it combines the power of ASP.NET,  LINQ, and new features in .NET 3.5 to create a web view of the database you define.

Looks like you could whip up some really cool views of your database in no time at all with this technology.  In addition it allows you to create custom data type templates so that when it maps a field to a data type you can control how it gets displayed.  It also has some nice custom validation that you can add onto it to make it a pretty powerful data driven site.

I'm not quite sure of its business value just yet.  I can easily see it being used to give some of your users easy views of your database and you have the ability to customize what they see.  I can also see it being used for e-commerce sites to quickly get product pages etc.  As for business systems the right now the only use I can see is for getting some prototypes up and ready for users in little to no time. 

Watch the video to see some of the other cool features.


Posted in:   Tags:
Well thanks to my dumb ass, I hit the wrong button on the blog editor and cleared out this post which I had about 95% done.  So I'm gonna make this quick and not rewrite the whole post, but long story short, avoiding XML and XSLT as long as I have came back to bite me in the ass.

At a current client I had to call a .NET web service by passing in a SOAP Envelope.  The return data was a .NET DataSet.  I then had to take that .NET DataSet and use an XSL Transform to parse out the data and return another, smaller XML chunk.  I had to do this to work with in the constraints of a 3rd party Sharepoint Workflow package known as Nintex Workflow.

I was able to get the DataSet back no problem, my problem lay in the XSL transform.  No matter what I tried or combination of XPath queries I tried, I was not able to parse out the data I needed from the DataSet.  I used Altova XMLSpy to take the results of the web service call and used that to give me the XPath queries.  Still, no luck, my XSL transform did not give me back the data, it didn't give me anything.  I asked around and luckily 1 person I asked knew exactly what my problem was.  The DataSet returned to me had an XML Namespace set in the properties.  He said to clear out that property of the DataSet and I should be fine.  Unfortunately i had no control over the web service or the DataSet it was returning to me.  So i had to figure this out.

I finally stumbled upon a combination of search results in Google that lead me in the right direction and after a few hours, and some good old trial and error, I was able to figure it out.  I had to put the XML namespace in the transform and then preface the XPath queries with the name that I gave to the XML namespace

Here are a few examples to illustrate my point.

Lets say you have a basic table of Person and you return an array of those as your DataSet.  Roughly speaking, here is what the basic XML should look like.

    1 <?xml version="1.0" encoding="utf-8"?>

    2 <PersonArray>

    3     <Person>

    4         <FirstName>John</FirstName>

    5         <MiddleName>H</MiddleName>

    6         <LastName>Doe</LastName>

    7     </Person>

    8     <Person>

    9         <FirstName>Jane</FirstName>

   10         <MiddleName>H</MiddleName>

   11         <LastName>Doe</LastName>

   12     </Person>

   13 </PersonArray>


Now, if you put the following XSLT onto the XML and open it in IE, you should see the Name of the first Person.


    1 <?xml version="1.0" encoding="iso-8859-1"?>

    2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

    3     <xsl:output method="html" />

    4     <xsl:template match="/">

    5         <h3>First Name:

    6             <xsl:value-of select="PersonArray/Person/FirstName" />

    7         </h3>

    8         <br />

    9         <h3>Middle :

   10             <xsl:value-of select="PersonArray/Person/MiddleName" />

   11         </h3>

   12         <br />

   13         <h3>Last Name:

   14             <xsl:value-of select="PersonArray/Person/LastName" />

   15         </h3>

   16     </xsl:template>

   17 </xsl:stylesheet>


To see the results in IE, put the following in between line 1 and 3 of the XML above.
<?xml-stylesheet type="text/xsl" href="person_basic_transform.xsl"?>

That is a basic XML example and how to apply a basic XSLT to it to spit back some data.

For the sake of this post, I've modified the following XML a bit, but its basically what you would get back if you called a web service that returned back a .NET DataSet

    1 <?xml version="1.0" encoding="utf-8"?>

    2 <?xml-stylesheet type="text/xsl" href="person_namespace_transform.xsl"?>

    3 <PersonArray xmlns="http://www.somesite.com/Something">

    4     <Person>

    5         <FirstName>John</FirstName>

    6         <MiddleName>H</MiddleName>

    7         <LastName>Doe</LastName>

    8     </Person>

    9     <Person>

   10         <FirstName>Jane</FirstName>

   11         <MiddleName>H</MiddleName>

   12         <LastName>Doe</LastName>

   13     </Person>

   14 </PersonArray>


As you can see, the PersonArray has an XML namespace attribute added to it.  This is what was giving me so much trouble.  If you use the previous XSL Transform above and apply it to this XML, you won't get back an results.  If you instead use the XSLT below, you will get back results.

    1 <?xml version="1.0" encoding="iso-8859-1"?>

    2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://www.somesite.com/Something">

    3     <xsl:output method="html" />

    4     <xsl:template match="/">

    5         <h3>First Name:

    6             <xsl:value-of select="test:PersonArray/test:Person/test:FirstName" />

    7         </h3>

    8         <br />

    9         <h3>Middle :

   10             <xsl:value-of select="PersonArray/Person/MiddleName" />

   11         </h3>

   12         <br />

   13         <h3>Last Name:

   14             <xsl:value-of select="PersonArray/Person/LastName" />

   15         </h3>

   16     </xsl:template>

   17 </xsl:stylesheet>


The difference with this XSLT and the one previously is i added the same XML Namespace as was in the DataSet and prefaced it with a name.  I then use the name I gave it in my XPath queries so that they know where to look.  I only did this for the First Name so that you can see the difference.  With out that XML Namespace, you won't get back the results you want.

I've packed these examples up in a zip file that you can download here.

Hopefully this helps someone that runs across this post and saves them some time.

Posted in:   Tags: , , ,
Tony Testa posted on December 9, 2007 00:00
I've been awaiting the release of the ASP.NET MVC framework for a few weeks now since hearing about it.  In a previous blog post of mine I listed some of the great .NET community talent that Microsoft has recruited to work on it. 

The CTP was SUPPOSED to be released Dec 7th, but due to some last minute bugs they have decided to delay it.  The good news is that it won't be delayed TOO long.  Should be released sometime next week.  Frankly, I have so much going on right now that even if it was released friday I wouldn't have had a chance to do anything with it for a few weeks :-(

In the mean time, I've compiled a list of some of great postings/tutorials with the new MVC framework.

Scott Gu's postings (Great info here)
ASP.NET MVC Framework (Part 1)
ASP.NET MVC Framework (Part 2): URL Routing
ASP.NET MVC Framework (Part 3): Passing ViewData from Controllers to Views
ASP.NET MVC Framework (Part 4): Handling Form Edit and Post Scenarios

Phil Haack
TDD and Dependency Injection with ASP.NET MVC

Just an FYI incase your like me and can't keep all the acronyms straight
MVC or MVP Pattern – Whats the difference?

Dino Esposito (Always able to give great arch. overviews of MS tech)
An Architectural View of the ASP.NET MVC Framework

Great article showing how to incorporate AJAX in with the new MVC framework...something i'll be very interested in checking out.
Ajax with the ASP.NET MVC Framework

As always, Rob Connery is on the cutting edge and incorporating the lastest MS tech into SubSonic.
SubSonic: MVC Preview Video

Posted in:   Tags: ,
Dino Esposito has a GREAT AJAX architecture article in the September 2007 issue of MSDN magazine.  It's a multiple part article and Part 1 goes into the basics of ASP.NET AJAX.
Whats really noteworthy in this article is that Dino drills down and shows you whats going on behind the scenes with an partial page request using ASP.NET AJAX and shows you some optimization tweaks you can make yourself to help performance a bit.

At the last talk I gave on ASP.NET AJAX,  I had put in place the groundwork for people to see that ASP.NET AJAX makes incorporating AJAX into your existing .NET 2.0 web apps, but that simplicity comes at a price.  One audience member put that together and asked if a partial-page request goes through the full page lifecycle and unfortunately I had to let him know that it does.  This series of articles should help show how you can optimize the performance.

Posted in:   Tags: ,
Tony Testa posted on September 27, 2007 00:00
I finally got my hands on the evaluations from the ASP.NET AJAX presentation I gave a few weeks back.  As a whole they are pretty good.  I appreciate all those that attended my session and gave me feedback.  The feedback REALLY helps me out because i've only given a few tallks/presentations so far, so I really use the feedback to see where my weaknesses are so that I can build off my next talk.

Thanks again!

For anyone that cares to read them, you can grab a zip of them here.

Posted in:   Tags: , ,
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017 Tony Testa's World