Coder Social home page Coder Social logo

hugoross / hafner.tools.settable Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 68 KB

Repository SetTracker provides a tiny helper type of the same name that can be used to differentiate between whether a parameter/property was set to null or was not set at all. Useful for filters (null not set = do not apply any filter for that property, null set = return all records that have null in that column) or UpdateRecord methods (null not set = don't touch that value, null set = change the value to null) etc.

License: MIT License

C# 100.00%

hafner.tools.settable's Introduction

Hafner.Tools.Settable

Repository Hafner.Tools.Settable (formerly Hafner.Tools.SetTracker) provides a tiny helper type of the same name that can be used to differentiate between whether a parameter/property was set to null or was not set at all. Useful for

  • Filters:

      public class AddressFilter {
    
          public Settable<String> FirstName { get; set; }
          public Settable<String?> MiddleName { get; set; }
          public Settable<String> Surname { get; set; }
    
      } 
    
    • not set: Do not apply any filter for that property
    • null set: Return all records that have null in the particular column
  • UpdateRecord methods:

      public void UpdatePersonData(int personId, Settable<string> firstName = default, Settable<string?> middleName = default, Settable<string> surename = default) {
          //Add firstName, middleName and surename to query if set and execute it
      }
    
    • not set: Don't change the value
    • null set: Change the value to null
  • Data Transfer Objects (DTOs):

      public class Person {
    
          public int PersonId { get; set; }
          public Settable<string> FirstName { get; set; }
          public Settable<string?> MiddleName { get; set; }
          public Settable<string> Surname { get; set; }
          public Settable<string?> ChangeHistory { get; set; }
      }
    
    • not set: Value was not loaded (e.g. the ChangeHistory might be omitted for performance reasons)
    • null set: The value is null in the database

etc.

hafner.tools.settable's People

Contributors

hugoross avatar

Watchers

 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.