Monday, July 28, 2008
This is a writeup for the last 2 architecture chats - both were pretty free-form, with little of the topics mentioned in the posts getting much discussion as we all had own things to talk about!

As a brief summary:

Plenty of talk about Lightweight code-gen and run-time vs. post-compile IL weaving, debugging integration etc. Hard to cover all the little facets that were explorer - but it's been interesting - it seems like more developers are starting to dabble with IL.

We talked about approaches for introducing cross-cutting behavior such as versioning and history to your data access and approaches for flowing metadata from your domain model up to the UI (including searching, validation etc.) and ways to index, query and flow the information across boundaries in the application.

As a tangent to this I've been talking about how I've been using MDA/MDG to drive the domain model generation (including things like validation, search annotations etc.).

We talked about the recent S3 outages and approaches for placing resources on both European and US data centers simultaneously, and possible ways to mitigate the double-upload bandwidth costs.

Discussions (sparked originally from a email discussion on the NZ dotnet user group) around hiding the implementation details of your ORM from the rest of your application - and the practicalities of how deep this needs to go, using linq through boundaries etc.

Discussions around injecting logic into generated source code, both in asp.net/winforms generated code as well as possible ways to intercept custom tool generation so you could manipulate the output.

Spartan programming got a mention - Peter felt it aligned with alot of his current coding style.

Embedding NHaml as a view engine in non-MVC applications, and the general experience with different view engines including Brail, ASP.NET MVC's default ASPX View engine etc.  (Including the error reporting and debugging experience) - We also talked briefly about the Spark view engine, which looks to be like it could be quite palatable to non developers while still offering a useful syntax for developers.

If anyone has any topic suggestions for next weeks chat just leave a comment on this post or flick me an email.

posted @ Monday, July 28, 2008 6:38:09 AM (New Zealand Standard Time, UTC+12:00)    Comments [5] | Trackback |
Wednesday, July 30, 2008 8:42:16 AM (New Zealand Standard Time, UTC+12:00)
That's an interesting set of topics Alex. I'll have to try and remember them for our next Wellington architecture chat ;-)

By the way, a couple of topics from the Wellington scene, which might be of interest since they relate to the topics you mention:

- Regarding customising the output of generated tools, check out Reegenerator. It's a local NZ product, and it gives a really nice way to intercept code generation from custom tools. Bascially, it lets you use the existing DataSet and LINQ-to-SQL design surfaces, but it replaces the custom tool with an equivalent one that has customisable source code. There's a video on the site that shows how it works. I've seen the author demonstrate it in person, and the seamlessness of the IDE integration was really impressive.

- I missed the .NET UG discussion unfortunately, but I wonder if this page on abstracting LINQ to SQL (for test purposes) but may be relevant to your topic too


Friday, August 01, 2008 12:59:43 PM (New Zealand Standard Time, UTC+12:00)
You can watch how to customize the designers generated code at http://www.reegenerator.com/ShowVideo.htm?video=Replace.swf
The video will show you how it works and then how easy it is to start building a LINQtoSQL code generator that gets invoked by the LINQtoSQL default designer.

You can download the code generators at http://www.reegenerator.com/TemplatesGallery.htm. You will get replacements for LINQtoSQL, Dataset, Resources and Settings designers (C# and VB). All the renderers emulate the default behaviour in order to offer you a familiar starting point for any customization you want to implement.


Monday, August 04, 2008 7:44:00 PM (New Zealand Standard Time, UTC+12:00)
kodeo: It looks like reegenerator just allows me to replace the code generated with my own template - ideally we were discussing retaining the existing generator (mostly for 3rd party products, where the generator or the source XML etc. is too complex to write a simple template for) so that we could get hold of the original generated code, and then apply changes/transformations to it, perhaps by parsing it into an AST, before outputing it.
Monday, August 04, 2008 7:53:17 PM (New Zealand Standard Time, UTC+12:00)
John: We talked about Mocking/faking out contexts... I think some of problems weren't so much the data-based bound aspects but how to even test linq expressions in isolation i.e. it's easier to look at say an NHibernate criteria and see what your sorting by, skip/take etc. Doing the same with an Expression<IEnumerable<T>> isn't as much fun - for instance to ensure the correct query is being passed from a controller to a repository, without having to actually execute the query on some in-memory data, then verify the results were correct.

How's the Wellington geek chats going? more interest now that it's hosted somewhere quieter?
Tuesday, August 12, 2008 9:40:36 AM (New Zealand Standard Time, UTC+12:00)
Alex: retaining the existing generator is actually a trivial job with Reegenerator. The customized code generator would look something like:

public class PassItOn : Generators.CodeRenderer
{
public const string CustomToolName = "MSLinqToSQLGenerator";
public override Generators.RenderResults Render()
{
byte[] ctResults = base.RunOtherCustomTool(CustomToolName);
string results = System.Text.Encoding.Default.GetString(ctResults);
return new Generators.RenderResults(results);
}
}

The RunOtherCustomTool method invokes an existing custom tool code generator and returns the results that would have otherwise been saved in the .Designer.cs file. Once you have the results you can parse and alter them in any way you like and pass the results back to Visual Studio to be saved instead of the original.
The example solution from the Customize Standard Designers Generated Code section of the http://www.reegenerator.com/TemplatesGallery.htm template gallery page, contains a class named PassItOn in the CustomizeDesigners project. The code is similar to the code above but with comments and with constants defined for LINQtoSQL Settings, Resources and Datasets.
If you have a specific problem in mind, let me know. We might be able to draft a solution in less than 10 minutes.
Comments are closed.
Search
FeedCount

Tags...
Who am I?
Alex Henderson
Alex Henderson
Auckland, New Zealand
Managing Director at Dev|Defined Limited

"Self Confessed Coding Junky for 15 years"
View Alex Henderson's profile on LinkedIn
 
Mobile: +64-21-402-969
Email: bittercoder 'at' gmail 'dot' com
MSN: bittercoder_nz@hotmail
Skype: alex.devdefined
Navigation