Giter Club home page Giter Club logo

msaccess-worker-a-orm's Introduction

Access-Worker-A-ORM

Micro-ORM For Access Very simple & Lightweight

Install

Relase Link

Download dll file & add your project via referance. I Will add nuget later versions.

How It's Work

To put it simply, it is a system that reads all the properties in the class and converts them into an access query's.

You can easily pull the data, send and update it with the id, send the data by filling the class, save the database, and access the id of the recorded record.

What can be done ?

  • List All Datas
  • List the data with the top. (Class,5)
  • Get first Data (Class,1).FirstOrDefault();
  • Insert data via filling class.
  • Update data via filling class with Identity

Using

Generate Struct or Class of the Table or Query

/*
 * DisplayName : Access Column name
 * DataObjectField(true) : Is Identity
 * Must be Same Order Table
 * Must be similar types.
 * if you want to update you must define one DataObjectField
 * Table Name can be getted via class Display Name attribute. If you don't have a D.N.A. code will use class name. Sturct is working only struct name.
*/

public struct Users
{
  [DisplayName("ID"), DataObjectField(true)]
  public int id { get; set; }

  [DisplayName("Name")]
  public string Name { get; set; }

  [DisplayName("Surname")]
  public string Surname { get; set; }

  [DisplayName("Age")]
  public int PersonAge { get; set; }
}

// OR

[DisplayName("Users")]
public class MyUsers
{
  [DisplayName("ID"), DataObjectField(true)]
  public int id { get; set; }

  [DisplayName("Name")]
  public string Name { get; set; }

  [DisplayName("Surname")]
  public string Surname { get; set; }

  [DisplayName("Age")]
  public int PersonAge { get; set; }
}
 
 

//Set the path.
AccesWorker.DatabasePath = Server.MapPath("~/DB/test.mdb");

//AccesWorker.Provider = "Else Microsoft.JET.OLEDB.4.0";
Insert
        // Fill class without identity.
var newuser = new Users()
{
  Name = "Jhon",
  Surname = "Doe",
  PersonAge = 32
};

var InsertedID = AccesWorker.Insert(newuser);
Update
       // Fill Class with identity
var updateuser = new Users()
{
  id = InsertedID,
  Name = "New Jhon",
  Surname = "Doe",
  PersonAge = 33
};

AccesWorker.Update(updateuser);
Select's
// Get All
  IEnumerable<Users> allDatas = AccesWorker.List(new Users()).Cast<Users>();

// Get 5
  IEnumerable<Users> top5 = AccesWorker.List(new Users(), 5).Cast<Users>();

// Get First
  Users getfirst = AccesWorker.List(new Users(), 1).Cast<Users>().FirstOrDefault();

msaccess-worker-a-orm's People

Contributors

lookus-1 avatar runaho avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

cagkanlookus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.