11 April 2008

SOAP header between flex client and .net web server

There is no day without invention.
Seems to be a simple code, but I manage to kill two hours to make it work.
This helps. Don't bother chinese. It just works.

10 April 2008

LINQ to SQL readings

Still under impression after LINQ to SQL session from IMTC.
The first thoughts are:
  • wow it is quick and easy;
  • code is generated for me for nice visual tool
  • full way from database to LINQ interface and classes is available to use out of box
To the end of session I remembered TDD and scratched my head with how apply this to it. Also I've samples of ugly t-sql generated - SQL Profiler is you friend forever.

Few days later I noticed the articles in my RSS Reader. And today ate 8 articles by Ian Cooper:

Architecting LINQ to SQL applications, part 1

...
Architecting LINQ To SQL Applications, part 8


He shows samples of unit tests and set ranges for layers. He advices to use class attributes or xml notation files but not a visual designer for craft entities. Oops. :( My dream of software factory blown away.

In my case I have quite complex database (which is far away from ideal). My application one of few and respectably consumes part of tables. My current approach is to generate all classes for whole database and add extensions in partial classes.
My issues are:
  • merging changes of database structure from other branches
  • ugly database content, which I managed to insert into each entity
  • difficulties with testing
  • serialising entity for passing to presenter (which is not .net)

What I learned from these articles:
  • cover only entities the application is using. I got this already. Our generation tool covers whole database when generates nHibernate mapping structure. This automatically transforms each FK into IList. One day this should go...
  • In the examples he stores an entity in a repository - this allows replace it with mock for testing. I have in reverse - each entity must have a link repository in order to operate;
  • My model for user session in not complete. I need to decouple it into module and make it flexible in order to move application onto it;
  • LINQ to SQL is not a magic. It is another ORM created with lessons learnt (are they?) from the past. Yep, there is a visual design, but this is for simple projects.