Code Monkey home page Code Monkey logo

notifire's Introduction

NotiFire

NotiFire is a Source Generator that creates automatic implementations of the INotifyPropertyChanged interface. For a given type, you can use the Notify attribute like this:

	[Notify]
	public partial class SimpleUserDTO
	{
		private int IdField;
		private string NameField;
		private string AddressField;
		private string CityField;
		private string ZipCodeField;
		private string PhoneField;
	}

Classes must be declared as partial for the generator to work. All fields in the class will have a property generated for them that will notify when changed. If you would like to specify specific fields to generate instead of all of them, use the Notify attribute on only the fields you wish to use. You can also specify the name you would like to have created for the given field using the PropertyName property:

	public partial class SimpleUserDTO
	{
		[Notify(PropertyName = "SimpleUserId")]
		private int IdField;

		[Notify]
		private string NameField;
	}

By default, the generated property names will follow this convention:

  1. If the field name ends in "field", drop the "field" and use the remaining name.
  2. If the field name starts with a _, drop the _ and use the remaining name.
  3. If neither of the above apply, append the word "Property" to the field name.
  4. If the name is null or whitespace after steps 1 or 2, use rule 3 as the name.

If there are fields you would like the generator to ignore, simply use the Exclude attribute on the field you wish to ignore:

	[Notify]
	public partial class SimpleUserDTO
	{
		[Exclude]
		private int Id;
		private string NameField;
		private string AddressField;
		private string CityField;
		private string ZipCodeField;
		private string PhoneField;
	}

Please feel free to open any issues, fork the code, contribute new features, etc. We're going to try to be great maintainers of this code.

notifire's People

Contributors

legacybass avatar wildcard65 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.