Code Monkey home page Code Monkey logo

baseentity's Introduction

BaseEntity .NET Core License NuGet

Package to make easier the creation of entities by encapsulating basic properties and methods

Installation

BaseEntity is available on NuGet. You can find the raw NuGet file here or install it by the commands below depending on your platform:

  • Package Manager
pm> Install-Package BaseEntity.Domain -Version 1.0.0-pre-1
  • via the .NET Core CLI:
> dotnet add package BaseEntity.Domain --version 1.0.0-pre-1
  • PackageReference
<PackageReference Include="BaseEntity.Domain" Version="1.0.0-pre-1" />
  • PaketCLI
> paket add BaseEntity.Domain --version 1.0.0-pre-1

Setup

There is no need for configuration or dependency injection.

How to Use

Just make your model class inherit from the Entity class. It is necessary to create an empty constructor for your class because it is used by the Entity Framework. The base constructor of the class receives a Guid, providing a unique identification for each record. Your class also inherit the CreatedAt, LastUpdate and DeletedAt properties, with the idea that soft delete will be your choice.

using BaseEntity.Domain.Entities;
using System;

namespace 
{
    public class Student : Entity
    {
        #region properties 
        
        ...

        public string Name { get; private set; }

        public DateTime BirthDate { get; private set; }

        public CPF Cpf { get; private set; }

        ...        

	    #endregion

        #region Constructors

        [Obsolete(ConstructorObsoleteMessage), false]
        Student() { }

        public Student(string name, DateTime birthDate, CPF cpf)
            : base(Guid.NewGuid())
        {
            Name = name;
            BirthDate = birthDate;
            Cpf = cpf;
        }

        #endregion
    }
}

License FOSSA Status

The project is under MIT License, so it grants you permission to use, copy, and modify a piece of this software free of charge, as is, without restriction or warranty.

FOSSA Status

baseentity's People

Contributors

leo-oliveira-eng avatar fossabot 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.