-
Notifications
You must be signed in to change notification settings - Fork 57
Development Guidelines
KostaVlev edited this page Mar 12, 2017
·
11 revisions
The first number represents the minimum and the second maximum column length
- Names - 2, 70
- First, Middle, Last Name - 2, 50
- Phone Number - 3, 15
- Tilte - 3, 70
- Descriptions - 70, 900
- Texts - 70, 900
- Project Name - 2, 900
For general information look at the C# Coding Conventions
The followings are examples of accepted code style.
Example 1
using System.Collections.Generic;
using Wilson.Accounting.Core.Enumerations;
namespace Wilson.Accounting.Core.Entities
{
public class Item : Entity
{
public string Name { get; set; }
public int Quantity { get; set; }
public Мeasure Мeasure { get; set; }
public virtual ICollection<InvoiceItem> Invoices { get; set; } = new HashSet<InvoiceItem>();
public virtual ICollection<Price> Prices { get; set; } = new HashSet<Price>();
public virtual ICollection<StorehouseItem> Storehouses { get; set; } = new HashSet<StorehouseItem>();
}
}
Example 2
public class AccountingWorkData : IAccountingWorkData
{
private readonly DbContext dbContext;
private readonly IDictionary<Type, object> repositories;
public AccountingWorkData(DbContextOptions<AccountingDbContext> options)
: this(new AccountingDbContext(options))
{
}
public AccountingWorkData(DbContext dbContext)
{
this.dbContext = dbContext;
this.repositories = new Dictionary<Type, object>();
}
public IRepository<InvoiceAggregate> Invoices => this.GetRepository<InvoiceAggregate>();
public int Complete()
{
// This is correct inline comment.
return this.dbContext.SaveChanges();
}
}
For code documentation use XML Documentation comments
Example
/// <summary>
/// Adds item in the Invoice. If the item is already in the Invoice then
/// the item quantity is increase.
/// </summary>
/// <param name="item">The item that will be added.</param>
/// <param name="price">The price for the item.</param>
public void AddItem(Item item, Price price)
{
....
}
See also:
WilsonTM is under BSD 2-Clause License.