RM Dev Diary

From Logic Wiki
Jump to: navigation, search


Starting Up

  1. Open Visual Studio 2013
  2. Create New C# ASP.NET Web Application (Application name : RM)
  3. Select MVC and Add Unit Tests and No authentication
  4. Install Specflow for VS 2013 by using Tools/Extensions and Updates/Online -> Search Specflow
  5. Restart VS
  6. Switch to project RM in Solution Explorer
  7. install specFlow
PM> Install-Package SpecRun.SpecFlow -Version 1.2.0
  1. Add new C# Class Library Project "RM.specs"
  2. Delete Class1.cs
  3. create "User" folder under RM.specs project
  4. Add New Item to RM.specs -> Users folder a Specflow Feature File
  5. Write a feature
  6. Install Entity Framework
PM> Install-Package EntityFramework -Pre -Version 6.0.0
  1. Create some models in Models folder
  2. Create DAL folder
  3. Create RMContext.cs file
  4. put dataset lines for each table in Rmcontext.cs file
  5. 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();

        }
  1. I create Pool Project and Security.cs in it.
  2. I create encrypt decrypt classes
  3. Applied the settings in Code First Approach
  4. Add everything to bitbucket (GIT)