Tuesday, March 27, 2007
Thursday, March 08, 2007
EastBay.NET Launch Event -- TONIGHT
I'll be speaking tonight on WCF in Pleasanton (a.k.a "P-town") for the EastBay.NET UG's Vista launch event along with Deborah Kurata and David Klitzke. Bring your appetites for Vista, WPF and WCF presentations as well as REAL FOOD! Yes folks, we'll have dinner tonight from Erik's Deli. :-)
For more information check this out. See you there!
For more information check this out. See you there!
Monday, March 05, 2007
Upgrade your May CTP VB LINQ Samples to Orcas March CTP
If you are playing with LINQ in Visual Basic, you'll probably want to check out Jim Wooley's post on how to convert a VB LINQ project from the May 2006 LINQ CTP to the March 2007 Orcas CTP. The syntax has changed including the order of the Order By and Select clauses. Even though it may look weird to the SQL people, there is a good reason for it, actually. Putting the Order By clause fixes a scoping issue where you now don't have to select the fields you want to order by. There's also now no need to put a := for named parameters, you can use the more normal =. Anonymous types also have a new syntax. Better intellisense should help you out. Julie also has some good information as well so check her (I mean her blog) out.
Thursday, March 01, 2007
Orcas March CTP Now Available
If you haven't seen it yet, here it is. VPC images and regular install packages are both available. (Though the specific feature list doesn't look like it's updated yet, you can read the overview.) A lot of things are finally coming together but I'm personally excited about LINQ. This CTP has the same features as the May LINQ CTP including LINQ to SQL and VB's XML literals. I'm off to download!......
Tuesday, February 20, 2007
VB WCF template in Visual Studio 2005 extensions for .NET Framework 3.0
Just an FYI to anyone that is playing with WCF 2005 extensions in Visual Basic. When you create a WCF Service Library in VB, the code for the DataContract1 class it provides does not have <DataMember()> attributes on the properties FirstName and LastName, so when you try to generate a proxy it doesn't generate correctly and the sample doesn't work.
New Project --> pick template VB/.NET Framework 3.0/WCF Service Library
You'll see that the code for the DataContract1 at the bottom of the file doesn't have any <DataMember()> attributes. This has been fixed in the Orcas CTP that's due out very soon. So for now just pop those attributes in there and then follow the rest of the directions in the template to set up a host and config files.
The template doesn't tell you directly how to set up a client to call it, but there is a VB example that shows you how. It's provided in the Program Files\Microsoft SDKs\Windows\6.0\Samples\ then extract the WCFSamples.zip and locate the \TechnologySamples\Basic\GettingStarted\VB\GetingStarted.sln. Here you can see a sample client and how to add the proper MetaData Exchange (mex) endpoint and service behavior so that you can generate the service proxy on the client side using "Add Service Reference" from the project menu.
If you're following the instructions in the template, to add the endpoint to the host console application you need to put this in your app.config (note, if your host is a web server then you will place this in the web.config):
New Project --> pick template VB/.NET Framework 3.0/WCF Service Library
You'll see that the code for the DataContract1 at the bottom of the file doesn't have any <DataMember()> attributes. This has been fixed in the Orcas CTP that's due out very soon. So for now just pop those attributes in there and then follow the rest of the directions in the template to set up a host and config files.
<DataContract()> _ Public Class DataContract1 Private m_firstName As String Private m_lastName As String <DataMember()> _ Public Property FirstName() As String Get Return m_firstName End Get Set(ByVal value As String) m_firstName = value End Set End Property <DataMember()> _ Public Property LastName() As String Get Return m_lastName End Get Set(ByVal value As String) m_lastName = value End Set End Property End Class
The template doesn't tell you directly how to set up a client to call it, but there is a VB example that shows you how. It's provided in the Program Files\Microsoft SDKs\Windows\6.0\Samples\ then extract the WCFSamples.zip and locate the \TechnologySamples\Basic\GettingStarted\VB\GetingStarted.sln. Here you can see a sample client and how to add the proper MetaData Exchange (mex) endpoint and service behavior so that you can generate the service proxy on the client side using "Add Service Reference" from the project menu.
If you're following the instructions in the template, to add the endpoint to the host console application you need to put this in your app.config (note, if your host is a web server then you will place this in the web.config):
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="WCFServiceLibrary1.Service1" behaviorConfiguration="metadataSupport"> <host> <!-- Stick this in here if you remove the baseAddress in the StartService method it creates for you. It's a good idea to change that to use this config file instead. <baseAddresses> <add baseAddress="http://localhost:8080/ConsoleApplicationVB/service1" /> </baseAddresses> --> </host> <endpoint address="" binding="wsHttpBinding" contract="WCFServiceLibrary1.IService1" /> <!-- Adds a WS-MetadataExchange endpoint at "http://localhost:8080/SampleService/mex" --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="metadataSupport"> <!-- Enables the IMetadataExchange endpoint in services that use "metadataSupport" in their behaviorConfiguration attribute. In addition, the httpGetEnabled and httpGetUrl attributes publish Service metadata for retrieval by HTTP/GET at the address "http://localhost:8080/SampleService?wsdl" --> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>Then start the service (this is important) and in your client select from the project menu "Add Service Reference" and put the MetaData Exchange endpoint as the service URI and it will generate the client code for you with no problems.
How to check the executing Type from the base class
Occasionally when designing base classes we need to know the type of the inheriting class executing the method (i.e. like when you're loading types from other assemblies dynamically or when it's not possible to change the inherited classes). You can either use the TypeOf operator in VB or use the GetType method that is available in the CLR to accomplish this.
Module Module1 Sub Main() Dim a As New A Console.WriteLine(a.Method1()) Dim b As New B Console.WriteLine(b.Method1()) Dim c As New C Console.WriteLine(c.Method1()) Console.ReadLine() End Sub End Module Public MustInherit Class Base Function Method1() As String If TypeOf Me Is A Then Return "Hello from A" ElseIf TypeOf Me Is B Then Return "Hello from B" Else Return String.Format("Hello from {0}", Me.GetType.ToString) End If End Function End Class Public Class A Inherits Base End Class Public Class B Inherits Base End Class Public Class C Inherits Base End Class
Friday, February 16, 2007
SOA Facts
One of my favorite sites on the web is a Chuck Norris fact site. If you've never seen it it's hilarious. Well they now have SOA facts which is equally amusing. Enjoy!
Tuesday, February 13, 2007
Sync Services for ADO.NET
If you haven't seen it yet, the Sync Services CTP was released a couple weeks ago. Today they released the documentation and samples. The sync services for ADO.NET enable you to develop occasionally connected clients much much easier. The sync framework provides easy detection of all the types of data concurrency and conflict handling issues you encounter when developing offline clients and makes it easy to code resolutions. Best of all it uses SQLce and the deploymemt package is under 2Meg. For more information see Steve's and Rafik's blogs.
BTW, I'll be speaking at DevTeach in May on the sync services and architectures of occasionally connected clients.
BTW, I'll be speaking at DevTeach in May on the sync services and architectures of occasionally connected clients.
Subscribe to:
Posts (Atom)