Api.Socioboard(Individual MVC4(WEB API) Project in the Solution)

From SocioBoard
Jump to: navigation, search

Api.Services provides the service to connect with database to access data and also make the data access platform independent.

API.Socioboard : To make this service platform independent we have made this as a separate project.

We have used NHibernate ORM for Data access from Mysql DataBase . Which require-

  • Domain(To Declare all properties)
  • Mapping(To map tables with with domain classes)
  • Helper(For SessionFactory)
  • Hibernate.cfg.xml(for configuration and give the connection string)
  • Models(contains methods to access with database)
1. Domain :
1.1 Services: All Services we use is present inside Services folder. 
Here is an Example:
YTXv6ci.png
These services are used in socioboard as these services has references as a web reference in
socioboard project. We will discuss about the required service when it will be used in the
socioboard project.

1.2 Mappings: This Folder contains all the Hibernate mapping files with the extension hbm.xml An Object/relational mappings are usually defined in an XML document. This mapping file instructs Hibernate how to map the defined class or classes to the database tables. Some of the Example of these files are:-

  • Admin.hbm.xml
  • Facebookfeed.hbm.xml
  • TwitterFeed.hbm.xml

1.3 Model: A Model , which represents the underlying, logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

  • It contains Repository classes that has Functions which contains the actual

NHibernate queries and sessions that is invariably used to Insert or fetch data from the tables of the Database.


KzoNffn.png

1.4 NHIBERNATE FILE(Nhibernate.cfg.xml): Hibernate requires to know in advance where to find the mapping information that defines how your classes relate to the database tables. Hibernate also requires a set of configuration settings related to database and other related parameters. All such information is usually supplied as a standard properties file called hibernate.properties, or as an XML file named hibernate.cfg.xml.

1.4.1 NHibernate PROPERTIES

lzi2X1m.png