It is a free .NET library which purpose is to provide transparent access and data manipulation on SQL Server databases through ORM (Object/Relational Mapping).
Because DBBroker is simple and discomplicated. Also because writing inserts, updates, deletes or queries in SQL language use to be a very tedious job for developers. Things get even worse when changes in the application model require a large revision in code. That is because Relational Objects must reflect database structure or vice versa.
That is why using DBBroker is a good idea, the greatest part of the job in data manipulation it is made by it. DBBroker makes the layer of data loading and manipulation transparent.
About the domain classes, DBBroker depends on 2 easy to follow conventions:
1. The required inclusion of a property of type int called 'Id'
2. The name of the properties of the class must match the name of the respective columns in the database
The mapping of the classes and properties uses 5 attributes (or decoration), they are the following:
As convention, for each domain class that application will access directly, must be created a corresponding data access class, it is in these classes that the magic happens.
These classes must have the same name of the domain class plus 'DB' (e.g. DBPerson for a domain class named Person).
After you do that, you will already be able to access methods like Save(), Delete(), GetById(), GetAll(), and ExecCmdSQL() to manipulate the data of the domain class of the context.
To make DBBroker able to reach your database it is necessary to create a simple configuration file in the base directory of your application, this file must be named 'DBBroker.config'.
The format of each line of this file has 3 values separated by the character pipe '|': (1) Namespace of de mapped domain, (2) constant value 'SQLServer', and (3) respective SQL Server Connection String.
MyGreatApplication.Model|SQLServer|Data Source=MyServer; Initial Catalog=GreatDB; User Id=minime; Password=Super§ecret;
Have some fun! If you like, please share. If you can, make a donation ;)
Thank you! ☺