Archive

Archive for the ‘Dev’ Category

Undo checkout of team member in Enterprise Architect

February 27th, 2010 raymondr No comments

At my current project we use Enterprise Architect. The data of EA is stored in a MS SQL Server. For source control purposes we use Team Foundation Server Source Control. When you perform a check out, the package gets an exclusive lock.

Yesterday, I wanted to change a model in EA, and found out the package was checked out by a team member just before he went on holiday. Unfortunaly, EA doesn’t support undo checkout operations for files checked out by other users. You will need the tools off your source control implementation. To perform a undo check out in Team Foundation Server you need the command line took TF.exe.

First lookup the filename of the xml file of the package under source control to find the userid and workspacename and perform the undo checkout in TFS.

tf.exe undo /workspace:[workspacename];[userid] /s:http://[TFSServer]:8080Â
"$/pathinTFS"

I was expecting I would be able to checkout the package, unfortunaly I got the same error message: “The package is checked out by another user”

Damn, the checkout information is not only stored in Source Control, the information is also stored in the EA repository.

How to undo this in the EA repository?

First lookup the package in the database. Select your favorit database query tool and execute this query:

SELECT	Package_ID, Name, PackageFlags
FROM	t_package
WHERE	Packageflags like '%CheckedOutTo%'

You will get a result with the currently checked out packages. In the field PackageFlags you find the information about the checkout.

VCCFG=<SourcontrolConfigName>;CheckedOutOffline=0;CheckedOutTo=<UserId>;

To undo the checkout, update the package without the CheckedOutTo information:

BEGIN TRAN
UPDATE	t_package
SET	PackageFlags = 'VCCFG=<SourceControlConfigName>;CheckedOutOffline=0;'
WHERE	Package_ID=<YOUR PACKAGE ID>
COMMIT

For safety, select the query above without the commit. If only one record is changed perform the commit, else abort.

Now, go back to Enterprise Architect and checkout the package.

Testing WCF services using MSTest

April 9th, 2009 raymondr No comments

However it’s possible to test your WCF services using unit test by just referencing your service implementation (see Ploeh’s Blog) You gain a lot of benefit if you use the WCF infra structure to test your services.

For Example, did you ever get the error message during integration test (or worse, production) because your message couldn’t be serialized because of a null value. This wouldn’t happen if your unit test were using WCF. Espacially when you have large messages with a lot of elements.

See Howard’s blog how to implement this.


Categories: .Net Tags: , , ,

WCF Multipart WSDL Download

March 30th, 2009 raymondr No comments

In the old days of ASMX webservices it was very easy to distribute the wsdl file of your service to other people, for example if you develop a service that’s not available to that person yet. The only thing you had to do was browse to http://myserver/mywebservice.asmx?wsdl and save the result of it. But nowadays the wsdl provided by your wcf service contains multiple files, the wsdl files uses import elements to include these file in the wsdl.

If you use svcutil.exe, wsdl.exe or some other tool to create a webservice client and reference a webservice directly this doesn’t matter. But this week I had to distribute my wsdl file and my service isn’t published yet. The only option was to download the wsdl file and each included file by hand.

After some searching for a neat solution I found a blog post by Mike Hadlow for downloading a wsdl and all included files to local disc. His solution makes use of the DiscoveryClientProtocol class in the .Net framework. This piece of code downloads all files but leaves the references of the xsd files pointing to the original url of the service. But this was also easy to solve. The WriteAll method of the DiscoveryClientProtocol class also creates a information file with the original location and the new filename. The only thing that has to be done is to replace the original urls with their local values.

Wsdl Download Executable
Wsdl Download source code

Categories: .Net, Dev Tags: , ,

How to use Log4Net in Unittests

March 29th, 2009 raymondr 3 comments

Curious why you unittest don’t log any messages using Log4Net? And you do have the configuration set in your app.config file? This is propably the result because your log4net config file isn’t deployed in the TestResult directory.

To enable Log4Net in your MSTest unittests :

  • Add your Log4Net file to the deployment files
  • Read the Log4Net configuration in your Assembly Initialize method (see below)

Add The Log4Net file to the deployment files

  1. Double click on the LocalTestRun.testrunconfig File
  2. Select deployment items
  3. Click Add
  4. Browse to your Log4Net config file.
    (This can be the same file as in your web or Windows project. In this way you use the same configuration as in your normal project.)

Reading Log4Net configuration
You can read the Log4Net configuration in you class initialization method but then you will have to put this information in every unittest class in you assembly. A better way is to put this code in the AssemblyInitialize method. The AssemblyInitialize method is just like the ClassInitialize method but this method will be executed only once before the execution of the unittest in your assembly.

Create a new class, for example TestAssemblyInit.cs and add the code below

[AssemblyInitialize()]
public static void MyTestInitialize(TestContext testContext)
{
// Take care the log4net.config file is added to the deployment files of the testconfig
FileInfo fileInfo;
string fullPath = Path.Combine(System.Environment.CurrentDirectory, "log4net.config");
fileInfo = new FileInfo(fullPath);

// Reload the configuration
log4net.Config.XmlConfigurator.Configure(fileInfo);

// test to see if it works
Log.Info("check");
}

Categories: .Net, Dev, Uncategorized Tags: , ,

TFS stops working after .Net Framework 3.5 SP1 update

March 11th, 2009 raymondr No comments

After installing the .Net 3.5 sp1 framework update on my Team Foundation Server, I noticed the hard way my TFS wasn’t working any more. Thanks to a little line below the error I noticed my TFS server was configured to ASP.Net 1.1 instead of ASP.Net 2.0. After changing this back to 2.0 (for every site and virtual directory!) every things works smooth again.

Categories: .Net, Dev Tags: ,

Android : IO Error unknown error

February 28th, 2009 raymondr No comments

droid_largeJava development is some while ago for me, but just got a new Android device so I installed Eclipse and the Android SDK on my Linux machine. But what you gonna develop? Well I couldn’t find a app on the Android market to control my SoundBridge device. So that will be my first project. Don’t expect to many results in the near future because I have currently a lack of spare time.

But on of the first things I ran into was an unknown IO error. The Soundbridge uses a kind of telnet interface to interact with, but I just could not open a connection. After some research I founded out, the application doesn’t have any permission to access the network by default. To grant the application network access you have to declare it in the AndroidManifest.xml file.


<uses-permission android:name="android.permission.INTERNET" />

It’s fully understandable, but another error message would be much more informative.

Categories: Android, Dev Tags:

Generate Silverlight 2 Proxy with SVCUtil.exe

February 20th, 2009 raymondr 5 comments

createUnfortunaly Silverlight 2 didn’t ship with any utility to generate a proxy class from the command line. Generating service proxy classes as service reference isn’t the way to go for me. Michael Giagnocavo wrote a little utility that makes use of a dll shiped with Silverlight to generate a proxy gut this one fails for me when I generate a little more complex proxy then HelloWorld. for example when I use multiple namespaces etc.

Read more…

Categories: .Net, Dev Tags: , ,

Optimistic Concurrency Control with MS Entity Framework and WCF or Webservices

October 26th, 2008 raymondr 2 comments

The Entity Framework makes it very simple to implement Optimistic Concurrency Control (OCC). To use this feature in combination with a disconnected application (Website/webservices), the recommend practice is to send both the original and the updated values of the object. This causes much larger network requests and could be done much more elegant.

How to use Optimistic Concurrency Control in ADO.Net Entity Framework using Webservices or WCF

Optimistic Concurrency Control in Entity framework
For using OCC in the Entity Framework you’ve got 2 options:
- using Stored Procedures
- Set the Concurrency Property of an object.

Read more…