This project is read-only.

What is NSQLObjects?

NSQLObjects is a lightweight and extendable O/R mapper. It is a very unobtrusive tool that lets you utilize the full power of SQL in queries.

Index to documentation

To define a simple read-only query, you would type the following lines:
query AllCustomers [[
  FROM Customers

NSQLObjects uses a DSL that verifies queries against an existing database and after that generates classes out of them that you can use for to read and optionally to update data. Queries can use any features supported by target database SQL select statement. Queries are compiled and the classes are generated within the project when a file is changed. The developer’s experience is very similar to, for example, WPF .xaml files. Unlike most tools using SQL statements, NSQLObjects validates all queries against an existing database and compiles queries to classes during normal build process.

Differences between Entity Framework or DLINQ and NSQLObjects are like differences between ASP.NET forms and ASP.NET MVC. NSQLObjects does not attempt to implement complex object oriented concepts to relation database. Instead it tries to make the use of SQL statements within a program code as a simple and robust user experience. NSQLObjects incur very little overhead to the actual query processing.

Why another O/R Mapper

NSQLObjects is different than most “normal” O/R Mappers like DLINQ or EntityFramework. In NSQLObjects, database classes are defined with a SQL query. NSQLObjects verifies the query against a database and generates the required classes from SQL schema.

Pros of NSQLObjects approach:
  • You can freely use powerful SQL constructs like table valued function or full text indexes in your queries. Hand crafted queries that uses advanced features of the SQL Server can be orders of magnitude faster when compared to generated queries and lazy loaded objects.
  • All queries can be sorted, filtered and paged on the server side. This simplifies web development where paging and sorting is required for all queries returning larger set of objects (rows).
  • Queries are typically designed to support individual operations (~use cases). This reduces code bloating and excess data loading. Well designed queries will return only information that is needed for current operation.
  • You can use existing database without any restrictions or rules. For example, you can use NSQLObjects on tables that do not have a primary key.

Cons of NSQLObjects approach:
  • LINQ is not supported on database level. You must use SQL queries. (Some basic database LINQ support for sorting, ordering and filtering is planned for future releases). This also prevents annoying bugs where LINQ to SQL translator fails to interpret C# to SQL.
  • Lazy loading is not directly supported (and generally should be avoided for performance reasons). If needed, .NET 4 Lazy<T> can be used to implement lazy loading with only minor overhead.
  • NSQLObjects is works with SQL server databases. (~SQL server 2005, SQL server 2008, SQL Azure)

Last edited Oct 26, 2010 at 8:15 AM by nolics, version 7


No comments yet.