TextMetal, a zero friction open source text templating engine for .NET and
Mono, announced full support for Mono for Android (MfA) 1.9. TextMetal is a
powerful text templating engine written in C# which uses an extensible
XML-based dialect and is suitable for use in automation scenarios and code
generation situations.

The TextMetal development team has been keenly interested in the MfA
platform for some time. Based on their own experiences crafting well
engineered data driven applications on the server and the desktop, the
mobile space is the next logical progression. Several large applications in
production leverage the tool and its output such as linkedinform.com,
imagefencing.com, vhda.com, et al.

Not wanting to reinvent the wheel nor wanting to leverage heavy, bloated,
complex object relational/mapping frameworks (LINQ, Entity Framework,
NHibernate, etc.), the development team originally built TextMetal as a
slimmed down fork of the previous Software is Hardwork Library (same
development team). This allowed the team to focus on text templating/code
generation scenarios in general; with automatically generated domain/data
layer generation in specific. While the code underlying the templating
engine remains mostly generic and constant, a set of baseline template XML
files (<root>\templates\AdoNet_Code_Generation) ship with TextMetal that,
when provided a SQL Server 2005 or higher database connection, will generate
a set of C# projects (DomainModel [data access], Unit Tests, and Integration
Tests). Within the C# Domain Model project, pure, clean C# code is generated
for: domain classes (tables and views), request/result/response classes for
stored procedures (where applicable), domain query classes, repository
classes, and mapping methods between the object and the database. Mapping
uses pure ADO.NET in a proper and generic manner; deviations from standard
behavior (parameter types, SQL dialect, etc.) are delineated on a connection
type basis and are selected and used at runtime transparently. The code that
is subsequently generated supports SQL Server 2000+, SQL CE 4.0, SQLite
(Mono.Data.Sqlite AND System.Data.SQLite) at runtime. All that is needed is
to change the target database is to edit the application configuration
(app.config, web.config, or see how to use Android preferences in our
samples): change the connection string
(connectionStrings/add/@connectionString in app.config/web.config) and the
(assembly qualified) connection type (connectionStrings/add/@ providerName
in app.config/web.config). Viola! A functioanly data layer. Classes are
generated as partial for customization while being re-generatively safe.

Of course, there is trade-offs in this approach: we value clean, debuggable,
performant data access layers over the alternative; you do not get LINQ
support (yet), dynamic queries, joins/projections, and if there are custom
logic needed, then you have to customize the generated code. The
applications thast the development team develops need speed and the lack of
some of the missing conveniences other frameworks offer is known and
understood. As this tool matured, adding support for a mobile platform
underscored the necessity for clean, debuggable, performant data access
code. The prior work and holding to philosophy paid off: TextMetal
supporting MfA generates fast data code AND baseline view XML code simply
and easily.

If you would like to learn more about TextMetal and its support for Mono for
Android 1.9, grab a copy of the source code suing Git and build it in Visual
Studio 2010 or MonoDevelop 2.6 from its project web site:

http://code.google.com/p/textmetal/

Various sample projects of real applications in production (desktop, web,
mobile) can be found in the 'samples' Git repository.

Feel free to suggest improvements and submit bug reports using the Issues
tool on the project web site.

Enjoy!

Daniel Bullington, TextMetal project founder
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to