Skip to content

Latest commit

 

History

History
101 lines (69 loc) · 2.41 KB

README.md

File metadata and controls

101 lines (69 loc) · 2.41 KB

VisualStudioTemplates

Here you will find some commonly used Visual Studio templates that I find myself creating over and over.

Install Instructions

Copy the template's folder and content into the following folder depending on VS version

%USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates
%USERPROFILE%\Documents\Visual Studio 2022\Templates\ItemTemplates

See also: How to: Locate and organize project and item templates

Templates

Item Templates

Creates a standard Repository class and interface for a given model class.

Includes basic CRUD operations:

Task<ICollection<$modelname$>> GetAll();
Task<$modelname$> GetById(int id);
Task<$modelname$> Create($modelname$ item);
void Update($modelname$ item);
void Delete($modelname$ item);

This template creates the three standard MediatR Request (Command), Response, and Handler class files.

Includes a basic ILogger from Microsoft.Extensions.Logging.

Just enter a name of the command and it will create a folder that matches the name and the three files.

Example if you enter in a name of "GetUser" it will create the following folder stucture:

/GetUser/GetUserRequest.cs
/GetUser/GetUserResponse.cs
/GetUser/GetUserHandler.cs

This template creates a basic ReactJS class component.

import React, { Component } from 'react';

export default class $componentname$ extends Component {
	constructor(props) {
        super(props);
        this.state = {
			loading: false
		};
    }
	
	async componentDidMount() {
	}

	render() {
		return (
			<div>
				<p>$componentname$</p>
			</div>
		);
	}	
}

This template creates a basic ReactJS functional component.

import React, { useState, useEffect } from 'react';

const $componentname$ = (props) => {
    const [loading, setLoading] = useState(false);

    useEffect(() => {

    }, []);

    // Data

    // Render

    return (
        <React.Fragment>$componentname$</React.Fragment>
    );
};
export default $componentname$;