March 28, 2009 any framework or tips for multi-tier applications | ||||
---|---|---|---|---|
| ||||
Hi All, We are redesigning a system (previously was written in C) using D. We use Boundary-Controll-Entity-Pattern. To wrap db table to entities is a very time consuming work. Is there any framework or tips for multi-tier applications in D? --Qian |
March 28, 2009 Re: any framework or tips for multi-tier applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Qian Xu | Qian Xu wrote: > Hi All, > > We are redesigning a system (previously was written in C) using D. > We use Boundary-Controll-Entity-Pattern. > To wrap db table to entities is a very time consuming work. > Is there any framework or tips for multi-tier applications in D? > > --Qian At times like this, I think of this blog post: http://ayende.com/Blog/archive/2008/03/11/Field-Expedients-or-why-I-dont-have-the-tools-is.aspx You can likely write some mixins to ease the use of Active Record. That would be the first thing I'd try. The simplest version I can imagine would either not work for relations: template Member(T, char[] name) { enum Member = T.stringof ~ ` ` ~ name ~ `() { return row.get!(` ~ T.stringof ~ `)(` ~ name ~ `); }`; } /* table Foo a INT, b BIT, c TEXT */ class Foo { private Row row; this (Row row) { this.row = row; } mixin (Member!(int, "a")); mixin (Member!(bool, "b")); mixin (Member!(char[], "c")); } |
Copyright © 1999-2021 by the D Language Foundation