BTI420 notes – future topics

Future plans…

*** Fit these in somewhere

Making views look better, 2015 Feb 17, Mar 31, and some “topics” documents
And in 2015 Lab 5
Theming, 2015 Mar 31

Assoc data principles… edit use case – usually do not edit the identifier for the associated object
Delete use case – disallow cascade delete, how to implement

Other possibles

Maybe NoSQL with MongoDB at the end of the course (no, too tired)

 Separate DAL DLL?

Git

Unit tests and TDD – ask Anna and Paul to work on this

Back fill

Visualizations, see pink file

“Summary” sections at the end of some of the Wednesday class notes pages

Learning the C# language, my role, your responsibilities, Resources
Put this in week 1 notes

Search for answers and help techniques
Put this on Resources page

Object initializer syntax, Jan 20
Embedded in the week 2 code examples – surface? discuss?

Concept of a strongly-typed model, 2015 Jan 22-26 (add a bit to Jan 22 – Jan 25 notes)

Late January, BTS430 to BTI420 translator

  • attribute – property
  • reference attribute – nav property
  • set – collection
  • controller is a generic name for a purpose-built module, most modules are “controllers”, our Controller is purpose-built to manage interaction logic for a collection of use cases

Summary reference (as an exercise) – how to configure the different kinds of associations

HTML Helpers, 2015 Jan 29-Feb 2 (back fill a brief mention into razor view introduction on Jan 15 – Jan 18)

Back fill – getting objects/collections by some other pattern than int id (e.g. string)
That affects the default route definition
May have to use attribute based routing
Alternative – future topic coverage

Is there anything from Edit and Delete in Feb 17 that we can use in the week 3 notes?

AutoMapper, create maps, new info on Jan 29 2016 from Jimmy Bogard, different way to create maps in the future, which will affect the following
Some images are in 2015 Jan 27 notes that could be re-done for the modern way of doing things

Photo Entity code example – attempt to add the Bootstrap carousel feature
If it requires changes to the design and view model classes, do it
How to do this example

File upload article, by Chris Pratt

 

(cut from rough notes about data preparation)

 

I created an app named GenericDatabaseCreator

It includes a library that imports xlsx to a DataSet – ExcelDataReader – seems to be well-regarded

https://github.com/ExcelDataReader/ExcelDataReader

 

Next, I needed a way to easily get the data from a dataset
Yes, I could have processed a table’s Rows collection, column-by-column, but no
AutoMapper would not do the job

Found and used this – an extension method that turns it into a strongly-typed List<TEntity>

http://codereview.stackexchange.com/questions/30714/faster-way-to-convert-datatable-to-list-of-class

 

The how-to-use info is on the /home/index view of the GenericDatabaseCreator app
In general, it works like this

  • make a copy of the app, and use the copy
  • change Web.config “initial catalog” to match the database’s purpose
  • copy/paste an xlsx to the App_Data folder
  • write entity classes, add them to the data context
  • modify and write code in the manager class
  • load the data with the URL /home/loaddata

 

 

(cut from proposed A8)

 

Data storage preparation tasks (two databases)

Before continuing, build/compile the project, and load it in a browser. Login (as admin@example.com), just to make sure that it works correctly.

Next, enable migrations, with this new technique that uses command arguments:

enable-migrations -MigrationsDirectory "Migrations\Security" -ContextTypeName Assignment8.Models.ApplicationDbContext

…then…

enable-migrations -MigrationsDirectory "Migrations\AppData" -ContextTypeName Assignment8.Models.DataContext

 

Yes, the argument appears to be case-sensitive. Why do we need the argument? The project template includes two (2) data context classes, because it uses two (2) different and separate databases. One database is dedicated to the ASP.NET Identity security information, while the other holds the Chinook sample database. Therefore, when we do migrations-related tasks in the package manager console, we must target our tasks at the correct data context.

At the end of enable-migrations, you should see this folder structure in your Solution Explorer:

migrations-step1

 

Notice that the Migrations > Security folder has two source code files. That’s because the security database – as provided by Microsoft in the ASP.NET Identity system – includes something called a “database initializer”. As a result, it’s ready to go.

Also notice that the Migrations > AppData folder has only one source code file. As a result, we must add a migration task. We do this in the next step. Run the command:

add-migration -ConfigurationTypeName Assignment8.Migrations.AppData.Configuration Initial

 

 

Now, you should see this folder structure in your Solution Explorer. It has the …Initial.cs source code file now, in the Migrations > AppData folder:

migrations-step2

 

Improve the role claims configuration

As you know, the Register() methods in the Account controller have hard-coded role claim values.

Not good, for an in-production real-world app.

Therefore, we will fix that now.

In the DesignModelClasses.cs source code file, create a RoleClaim class, with an identifier property, and a string property “Name” (required, string length 100).

Add a DbSet<TEntity> property to the DataContext class.

In the Manager class, use the LoadData() method to create and save some new role claims. Let’s continue to use the idea that we had in Assignment 7, with role claims for Executive, Coordinator, Clerk, and Staff. Add two others, and you decide what they will be.

Like you probably did before, create a LoadData controller, and call the manager object’s LoadData() method.

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Advertisements
%d bloggers like this: