RM Dev Diary
From Logic Wiki
Starting Up
- Open Visual Studio 2013
- Create New C# ASP.NET Web Application (Application name : RM)
- Select MVC and Add Unit Tests and No authentication
- Install Specflow for VS 2013 by using Tools/Extensions and Updates/Online -> Search Specflow
- Restart VS
- Switch to project RM in Solution Explorer
- install specFlow
PM> Install-Package SpecRun.SpecFlow -Version 1.2.0
- Add new C# Class Library Project "RM.specs"
- Delete Class1.cs
- create "User" folder under RM.specs project
- Add New Item to RM.specs -> Users folder a Specflow Feature File
- Write a feature
- Install Entity Framework
PM> Install-Package EntityFramework -Pre -Version 6.0.0
- Create some models in Models folder
- Create DAL folder
- Create RMContext.cs file
- put dataset lines for each table in Rmcontext.cs file
- Add these lines
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
# I wrote Seed function like
protected override void Seed(RM.DAL.RmContext context)
{
var appUsers = new List<AppUser>
{
new AppUser(){ FirstName="Ali", LastName="Iybar", Username="SysAdmin", Password = Pool.Security.Encrypt("esref"), AppUserType=UserType.SysAdmin, LastEntry = DateTime.Now},
new AppUser(){ FirstName="Ali", LastName="Moktashi", Username="Account", Password = Pool.Security.Encrypt("esrefacc"), AppUserType=UserType.Accountant, LastEntry = DateTime.Now},
new AppUser(){ FirstName="Aykut", LastName="Gurel", Username="Sales", Password = Pool.Security.Encrypt("esrefsale"), AppUserType=UserType.SalesAgent, LastEntry = DateTime.Now},
new AppUser(){ FirstName="Davut", LastName="Pinarbasi", Username="Owner", Password = Pool.Security.Encrypt("esrefown"), AppUserType=UserType.AccountOwner, LastEntry = DateTime.Now},
new AppUser(){ FirstName="Ibrahim", LastName="Kilickaya", Username="User", Password = Pool.Security.Encrypt("esrefusr"), AppUserType=UserType.AccountOwner, LastEntry = DateTime.Now},
};
appUsers.ForEach(s => context.AppUsers.Add(s));
context.SaveChanges();
}
- I create Pool Project and Security.cs in it.
- I create encrypt decrypt classes
- Applied the settings in Code First Approach
- Add everything to bitbucket (GIT)