Documentation of free .NET O/R Mapper - Code Generator Invist

Edit

Create simple application

All Examples in the documentation are based on the Northwind database. There are all Problems listet, like Tables with spaces, Single and multi Primary key and so on. For using Invist please open a project or create a new one and follow the the steps.

  • Open the Options of Visual Studio over the menu [Tools --> Options ...]
  • Select "Invist"
  • Click Add-Button
  • Add a key for a connection and a valid connectionString as shown below

Add Connection

  • Add a reference to the Invist.Persistence.dll
  • Add a reference to the Invist.Persistence.Database.dll
  • Add a configuration File (app.config or web.config) to your project and configure a connection with Name 'Invist'

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <connectionStrings>
        <add name="Invist" 
            connectionString="Data Source=MIRACULIX\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
            providerName="System.Data.SqlClient"/>
    </connectionStrings>
</configuration>

  • Add new Item to Project and use "Invist" in "My Templates" and choose a database in list.

add new item

  • Ensure that all names of classes, stored procedures and views has no spaces.
  • Press save, when the names are as you like.

Edit

Load Entities

Load Data is very simple. As show in code below, Entries from Table "Employees" will be loaded as strong typed as defined in designer of Invist.

// Sample to Load all Entries of class "Employee" saved in table "Employees"
var loader = new EntityLoader<Employee>();
var list = loader.LoadEntities();


// Sample to load all Entries of class "Employee" saved in table "Employees" where Firstname equals "Mirko"
var loader = new EntityLoader<Employee>();
var firstnameFilter = new ConstantValueFilter( typeof(Employee), Employee.FirstNameProperty, CompareOperator.Equal, "Mirko");
IEnumerable list = loader.LoadEntities(firstnameFilter);

For detailed information about filtering data, see documentation for filters.

Edit

Persist Entities

Persist Data is as easy as load data.

// Create a new Employee and persist
Employee employee = new Employee();
employee.FirstName = "Mirko";
employee.LastName = "Meier";

var manager = new EntityPersistenceManager();
manager.Add(employee);
manager.Persist();

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam. Invist is powered by Mirko Meier