Thoughts from the Wet Coast
The musings of an ASP.NET Developer from Canada's We(s)t Coast
I continue my deep dive into DotNetNuke 7’s new DAL 2 with a look at the features that make up the repository component.
The IRepository of T interface can be considered the core of the new DAL 2. While the Execute methods of the IDataContext interface provide a DAL + like API, the benefits of the new API are really found when using the repository. The Repository Pattern is a common design pattern in modern data access layers.
So far I have done a relatively high level review of the DAL 2 API. In this blog article I will start to take a deep-dive into the components that make up the API, beginning with the DataContext.
The IDataContext interface and the PetaPocoDataContext concrete implementation act as the entry point into most aspects of the DAL 2 API. While implemented as an Interface there is no expectation that any other implementation will be created, but the interface allows us to mock a concrete implementation for Unit Testing purposes.
I presented a session on the DAL 2 at DNN World in Orlando, and a few people asked about “calculated” properties - or properties that do not have any matching column in the database. This is an important feature for any “auto-mapped” repository implementation, so we have added three new Attributes that control the mapping of properties and columns.
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.