Archives / 2007 / November
  • LINQ to SQL...compact!

    Tags: .NET 3.5, SQL

    You are all undoubtedly aware of LINQ to SQL, its fair to say its had a large amount of publicity and coverage in the .net circle.  VS 2008 makes getting going with LINQ to SQL very easy but that is not the case with SQL Compact (yet!).  However its not difficult if you have heard of a wonderful little app called SqlMetal, this little beauty will generate the .dbml files for you...happy days :)

    I have a small SQL Compact database to use for this demo, you can see it here in VS 2008 server explorer...


    Run VS 2008 Command Prompt, navigate to the location of your .sdf file (you can of course run SqlMetal using the full file path to the .sdf but I just prefer the prior) and type...

    >SqlMetal SqlCeFileName.sdf /dbml:LinqClassName.dbml

    That will create the dbml file in the same directory as the .sdf file, now add it to your project in the normal way.


    You can open the .dbml file in the same way and you will get the VS 2008 designer because its doesn't care what provider you are using (SQL CE) that will be sorted at runtime - right now you are just looking at a .dbml file.


    You can now use LINQ in the same way as you would for SQL Server...

    Tageditor te = new Tageditor(TagEditor.Properties.Settings.Default.TagEditorConnectionString);

    Note: I am passing the location to the SQL Compact database file to the constructor of the LINQ class ( "Data Source=|DataDirectory|\\Data\\TagEditor.sdf" ), as I said before, I don't need to specify anywhere that the provider is SqlCE, that is inferred at runtime! :)

    You can now use LINQ in the same way to work with your database - I wont go into LINQ here, there are plenty of resource around to are a couple I found useful.


    ScottGu's 9 part series on LINQ - all you need to get going really.

    SQL Compact Edition

    MS SqlCe Home

    SqlCe Blog

    SqlCe FAQ by Steve Lasker


    Technorati Tags: , , ,


  • Safari, Browser of choice?

    Tags: Personal

    Is it just me or is Safari for windows creeping in as the browser of choice??

    I still find a fair few sites, especially banking ones that warn that I am using a "non supported" browser but I find it just renders the page better.  Font smoothing is better and the graphics just seem sharper...

    Its not perfect and lacks a few of the features I know and love in IE but for "leisure surfing" its great!

    Technorati Tags:


  • New Phone - Nokia N95

    Tags: Personal

    To celebrate the release of the iPhone in the UK today, I got a new Nokia N95.  Why? Well I have read some shocking reviews of the iPhone from people in the US and many have returned the phone.  Also, in my opinion the N95 looks to be a better phone.  There is of course the ridiculous cost of an iPhone here in the UK it's £269 which you in the US that keep track of the exchange rate will know its nearly $550.  Then there's the available tariffs...£35 a month with only 200mins...what a joke, I get 400mins, 1000 text and unlimited calls to same network users on mine :)  No denying it looks cool but I think I'll wait till the dust settles, bugs are ironed out and the phone is feature complete at a reasonable price!

    So far the N95 seems really cool, loads of groovy features to play with, my favorites so far is probably GPS but the wifi is cool...quick Internet on a mobile phone, how novel!! Being at a computer most of the day I never really use phones for much more than phone calls, the most important thing for me with a phone is that its small enough to be in my pocket without really knowing its there - otherwise I'm not interested!  I generally even text via bluetooth connection on my lappy now :)  Looking forward to having a play with the GPS though...see if I can do something like where's Tim.



  • Cruise Control Build Server

    Tags: TFS

    We have recently started using Cruise Control to manage our build processes, this works great with web deployment projects and TFS.

    Cruise control for those who dont know, is, according to the website "CruiseControl is a framework for a continuous build process. It includes, but is not limited to, plugins for email notification, Ant, and various source control tools. A web interface is provided to view the details of the current and previous builds"

    We run it on a separate box (soon to be a virtual box), it has a nice simple web interface to force builds if you so wish and a small windows app that shows the status of each project and notifies you of completed builds.

    <projectname="CC Project Name">
      <labellertype="dateLabeller" />
        <project>$/TFS Project/</project>
          <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
        <!-- Take a backup of the build so we can roll back-->
          <sourceDir>Build Drop</sourceDir>
          <publishDir>Backup Drop</publishDir>
        <externalLinkname="Project Home"                  url="http://URL Shown on CC Project home page - I have link to TFS portal"></externalLink>

    Most of the work is done is an XML file, in here I create the project and tell it where the source control is (TFS server in our case) then what tasks I want to execute for the build. Calling msbuild is the key one here but there are other cool features like making a backup of the build, NUnit and any external app.

     What makes this really cool for applications is using the web deployment project. I have setup the required config files in my application so the deployment project will make the necessary changes to the web.config for my connection string and app settings for the dev, stage and live environments and deploys the web app to the stage or live IIS server.

    Cruise control shows in its logs any and all changes to the project's source and any comments that have been made on check in, so its nice and easy to find a reason why the build failed.

    Another cool feature is CCTray, which is a windows app that talks to the build server, shows the status of all projects and shows notifications of complete builds.

    Now we have a complete history and backup of all builds!! Sweet! :)

    I'd be interested to know what "build environments" people use, please comment!

    Technorati Tags: