Archive for September, 2008
LINQ To SQL - Going POCO and more……! Part 2.
In part 1 of this post I made the code available for a framework that I named Golden Gate, which provided the pieces to use a POCO approach in using the LINQ To SQL OR/M along with Specifications (for dynamic querying and equality testing) and Fetching Strategies (providing flexible load options to suit the eager or lazy load requirements). What was missing in the code download was an example that utilised the DataContext classes ability to provide lazy loading or deferred loading as it terms it. The code below demonstrates how to create your POCO entities to allow for this.
//For the One to Many side of a relationship private EntitySet<RingtailPage> _pages; public IList<RingtailPage> Pages { get { return _pages; } set { _pages.Assign(value); } } //For the Many to One side of a relationship private EntityRef<RingtailDocument> _document; public RingtailDocument Document { get { return _document.Entity; } set { _document.Entity = value; } }
Whilst the use of the EntitySet<T> and EntityRef<T> dont exactly fit the purist POCO approach, it’s a small price to pay when you consider that access to them are wrapped by an accessor mutator that exposes the Entity in question or an IList<T> where T is the entity in question. Matthew Charles explains why EntitySet<T> and EntityRef<T> are required for LINQ To SQL lazy loading.
No commentsUdi Dahan SOA and DDD training not to be missed!
It has just recently come to my attention that Udi will soon be running his advanced distributed systems design course in Austin Texas with Jeffrey Palermo’s crew at Headspring. I was fortunate enough to take this very course earlier this year in Australia and I can truly say that my thinking, planning, designing and output have all been enhanced in the most profound ways since doing so, it was one of those great eye opening experiences that can move you to another plane of thinking.
Judging from the course outline on Udi’s site, it would appear that some new material has found it’s way onto the syllabus (I’m jealous), which covers Ultra High scaling possibilities by leveraging REST and after hearing Udi’s podcast on that topic I think I have a feel for what that promises and can only say that I wish I could make the trip to the US to be there.
Whilst I gained enormously from the SOA and DDD content, I also took away some wonderful stuff from the ‘Smart Client’ sections of the training. My team have been using our own home grown MVP framework for some time now and Udi certainly expanded our thinking there, particularly with regard to multi threading issues - greatly useful stuff.
When I had the privilege of sitting through this training I did so with my team and cant say enough about how it invigorated, improved and turbo charged the mind-set and output of all who attended. Udi is a very skilful presenter and a wonderful teacher and significantly has amassed some great wisdom that anyone who is serious about building Service Oriented systems should go out of their way to experience and imbibe. If your in Austin Texas or anywhere in the United States for that matter, I thoroughly recommend you take this course, it is worth far more than the advertised price. Prepare to have some of your beliefs challenged and come with a spirit of learning and you will enjoy the rewards - I know I have and so have many of my colleagues. I know that I personally often find enormous value in listening and learning from people of the quality of Udi and Randy, so imagine spending a week in the company of one such teacher!!!
No commentsPOCO Custom Multifile Assembly and ReSharper
I recently compiled all the libraries from my most recent post on LINQ To SQL, into a Multifile Assembly so people could play with the bits without having to load up the projects that make up the POCO Framework which contains the Repository / Specification and Fetching Strategy libraries in it’s VS.Net solution.
The trick in creating a custom multifile assembly is to take all the files from the libraries that you wish to blend into one assembly, compile them into netmodules and then combine them all with the Assembly Linker otherwise know as al.exe. In my case the modules were as below:
and the last command I had to execute on the command line was:
al <module name> <module name> … /main:<method name> /out:<file name> /target:<assembly file type>
where the module names were from my list above.
One thing to watch out for if your a ReSharper user: the multifile assembly (your DLL compiled from the netmodules) may not be recognised correctly by intellisense in VS.Net 2008 and may report that it cannot resolve symbols. I didn’t dig into the cause of this problem however turning ReSharper off will stop the warning and code window highlighting but the problem does not stop VS.Net successfully building and executing your code nonetheless.
As you can see, the ‘Repository’ type is not having intellisense resolve it correctly and it is showing up in RED! But let me re-iterate that this will not preclude your code from building and running in VS.Net 2008 and turning off ReSharper will remove the intellisense problem altogether.
The multifile assembly for my previous posts code can be found here and if you browse it in Reflector you can see that it incorporates all the namespaces and code from the multiple projects in the LINQ To SQL going POCO solution.
No comments







