A Short Video Tutorial on How To Fade in and out with Adobe Premiere

Check out this short 90 second video on how to add audio fade in and fade out on an instructional video.  I do this on my current video I’m making for Pluralsight on ASP.NET Multi-Tenant coming out soon.

Converting a Controller Method in MVC5 to async

I’m currently working on a Pluralsight course on ASP.NET and I have to admit I’m slow to adopt async methods in my code because it feels a little complex when non-async code is what I’m use to.  I’m feeling like since I’m doing this Pluralsight course I should really show best practices and clearly async controller methods is no doubt a best practice.

I’m surprised it was actually so easy.  First, let me show you the code that I had written that is not async that I’m sure you are all familiar with.

All I had to change (besides adding the async name space for Task) was to have speakers return a task with the ToListAsync method and change the signature of the method to return a task. Here is the updated code that is now fully async.

Using map instead of a for loop in ECMAScript 5 JavaScript




Just Sayin…

Seeding a Many to Many With Entity Framework and C# Dynamic

In the previous post, we created a single table (speakers) with Entity Framework Code First from a JSON file with Visual Studio 2015.  Now we will add a sessions table that has a many to many relationship to the speakers table.  That is, speakers can have multiple sessions and sessions can have multiple speakers.  We do that but simply creating another entity (sessions) and add to it a List of speakers and then adding to the existing speakers table a list of sessions.  The new table (models) look as follows.

GitHub Repo: https://github.com/pkellner/EntityFrameworkSeedFromJSON

Then,  we need to add sessions data (from the JSON file) but when we add the sessions, we need to add the speakers records associated with each session.  That is, we simply populate the List of sessions in the speaker model to make this happen.

One problem we ran into was that EF Code First really wants to control the Id of each record and since in our original data, the many to many relationship was maintained by original primary keys, we need to bring along the original speaker Id.  We do this by simply adding an extra column to the speaker model called PictureId and set that as an attribute (column) of the speaker table.  Then, we can use that to search the speakers table for the existing speakers.

The code below (and also in the GitHub repo) basically does this for us.  It again uses NewtonSoft.JSON as well as the dynamic type in c# to get the job done.

To test the results, in Program.cs we put some simple loops and Console Write’s to show.


Plugin by Social Author Bio


Get every new post delivered to your Inbox

Join other followers: