Giter Site home page Giter Site logo

boycott's Introduction

.net rocks!

Powered by C#

configurationless, code only, .net ORM library

Setup Provider

Configuration.DatabaseProvider = new MySQLProvider("localhost", "tsukianimes9", "root", "root");

Synchronization process

var sync = new Synchronizator();
if (!sync.DatabseExists) {
    Configuration.DatabaseProvider.CreateDatabase();
}

if (sync.Check()) {
    sync.Sync();
}

Defining a class

class Airport : Boycott.Base<Airport> {
    public int Id { get; set; }
    public string Name { get; set; }
    public string Code { get; set; }
    public string City { get; set; }
    public string CityCode { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}

Get item by id

`    var airport = Airport.Find(1);`

Create an item

var airport = new Airport() {
    Name = "Guarulhos international Airport",
    Code = "GRU",
    City = "São Paulo",
    CityCode = "SAO"
};
airport.Save();

Complex find using LINQ

var airports = (from a in Airport.db
                where a.Name.Contains("guarulhos")
                orderby a.Name
                select a).Take(10).ToList();

Get all rows

var airport = Airport.All();

Mapping a legacy table

[NotSynchronizable]
[Table(Name = "forum")]
class Forum : Boycott.Base<Forum> {
    [Column(Name = "ForumId", IsPrimaryKey = true)]
    [DbType(DbType = Boycott.Migrate.DbType.Char)]
    [ColumnLimit(Limit =36)]
    [NotNullable]
    [PrimaryKey]
    public Guid Id { get; set; }

    [Column(Name = "PartnerId")]
    public Guid PartnerId { get; set; }

    [Column(Name = "CategoryId")]
    public Guid CategoryId { get; set; }

    [Column(Name = "AuthorId")]
    public Guid AuthorId { get; set; }

    [Column(Name = "LastPostId")]
    public Guid LastPostId { get; set; }

    public string Title { get; set; }

    public string Description { get; set; }

    [Column(Name = "TopicCount")]
    public int TopicCount { get; set; }
}

boycott's People

Contributors

felipecvo avatar

Stargazers

Artur Caliendo Prado avatar

Watchers

Artur Caliendo Prado avatar James Cloos avatar

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.