Uncategorized Archives - Digital Tool Factory blog Uncategorized Archives - Digital Tool Factory blog

The Digital Tool Factory Blog

How to fix problems with entity framework migrations

  1. First – backup the __MigrationHistory table in the database
  2. Get rid of old migration files
  3. add-migration using the usual syntax, but with nothing modified
  4. Remove all of the “Create Table”, etc – the migration should look like
  5. public partial class domorenow : DbMigration
    {
    public override void Up()
    {

    <code>    }
    
        public override void Down()
        {
    
        }
    }</code>
  6. from there do the update-database -script to generate a sql file
  7. then just update-database -verbose
  8. All Fixed

14
Feb 19


Written By Steve French

 

How to fix problems with jquery data tables and a list of objects from ASP.net Web API

The main problem is that data tables does not expect a list of objects, instead it wants a differently formatted json object, something like

data: {“Property”: Value}

etc
Instead it’s getting a pure list, like this

[
{“Name”:”Value},
{“Name”:”Value},
{“Name”:”Value},
{“Name”:”Value},
{“Name”:”Value},
]

Solution – list out the values in the columns property of the data table, like this

$(document).ready(function () {
$(‘#example’).dataTable({
“deferRender”: true,
“processing”: true,
“iDisplayLength”: 25,
“ajax”: {
“url”: “https://domain.com/Ajax/v1.1/ListTypes”,
“dataSrc”: “”
},
“columns”: [
{ “data”: “Name” },
{ “data”: “OtherColumn” }
]
});
});

And you’re done!


10
Oct 18


Written By Steve French

 

How to fix irritating problems with TFS and Visual Studio 2017

Update – I did some more Googleing and found this page

Whereupon it says to

In your Team Explorer panel, click on Home > Projects > New Team Project…

Actually you have to click on Home to do it

but that gives you

Create from there

 

Due to a variety of circumstances I’m creating new projects with Visual Studio 2017, but using Team Foundation Server 2015 to house the source code – here is the proper sequence (for me) that gets the source code in place properly

  1.  Create Team Foundation Server Project using Visual Studio 2015 – note remote origin server
  2. Disconnect from VPN (and therefore TFS)
  3. Create Solution normally using Visual Studio 2017
  4. Do the normal “Add to Source Control” (from the File menu)  (if you do this while connected to the VPN/TFS it will try to force you to save it to TFS (where you can’t create a new project, or see the project you just created) – it will then do all the Git setup normally
  5. Reconnect to the VPN
  6. In the Team Explorer settings, add the remote origin server location to the “Remotes” section in the Repository settings – don’t forget to use the name “origin” as the name
  7. Commit and Push – everything should be working fine.

I’m sure there is a much better way to do this, but this is what works for me.


01
Dec 17


Written By Steve French

 

What to do when intellisense stops working in java script files in Visual Studio 2015

Recently I was working on a project and noticed that none of my jquery code extension were working in Visual Studio 2015.  After much rending of garments and gnashing of teeth I discovered that the jquery code snippet plug just doesn’t work with jquery 3 – I downgraded to the most recent version of 2.0 and it all worked perfectly.


05
Mar 17


Written By Steve French

 

How to fix the Compiler Error Message: The compiler failed with error code 255 error

Recently I was deploying some sites, and got the error “Compiler Error Message: The compiler failed with error code 255.” – which looks like this

after some research the cause of, and solution to was all in the nuget package manager.  I had recently added a new project to the solution and some of the more “stock” nuget packages were out of sync with with the newer packages.  Make sure all of the nuget packages are the same version and your problems will be resolved.


15
Jul 16


Written By Steve French

 

How to set the zoom level in Visual Studio 2015

This is non-intuitive, but all you have to do is click in the zoom area – type in the value (in my case 90%) and then click enter, NOT TAB OUT.

That just threw me for ten minutes.


05
May 16


Written By Steve French

 

How to fix problems with FoolProof Validation in asp.net mvc

For some reason the otherwise delightful nuget Package FoolProof Validation does not work with modern version of the entity framework – rather, the validation works just fine, but it chokes when you try to update the database with entity framework.

The workaround I found was to validate on a view model – and then translate that viewmodel to the actual model, which is then sent to the database.


20
Mar 15


Written By Steve French

 

How to fix problems with Jquery Validate and dynamically generated forms

I recently came across the problem of validating dynamically generated forms with the jquery.validate plugin – everything worked well with the original form, but when there were multiple forms available I got peculiar syntax errors. A quick googling told me to simply add the following code

$(“form”).validate();

to the javascript and everything would be fine. I tried that to no avail. Then I read things more closely and realized that I needed to specify which form I wanted to validate, I changed the code to

$(“#editForm”).validate();

And voila! Problem so.


03
Mar 15


Written By Steve French

 

How to use query strings in framesets with asp.net mvc 5 routing

The problem – I was working on a project that required frames – and I was trying to pass a querystring value to the frameset, as in /FramePage/?page=/SomePageOffSite.aspx – my first thought was to just pass the url of one of the frames to the frameset page as a string.  I made the model for the view a string and attempted to pass it via the usual way in the controller, i.e.

return View(“MyFramedInPage.aspx”);

My thought was that I could just use the Model property as the url, as in

frame src=”@Model” name=”main” noresize scrolling=”auto” marginheight=”0″ marginwidth=”0″

However, whenever I did that MVC would try to find a view with the url of the string (in this case SomePageOffSite.aspx – which did not exist) I was passing in the model.  I eventually figured it out – there is a feature I never use on return View – to wit – you can redirect it to another view simply by passing in the view name (I always used the redirect option) – therefore you can’t ever use a model as a string.  Lesson learned.


11
Feb 15


Written By Steve French

 

How to web deploy to a virtual directory or web application in IIS and Visual Studio 2013

For whatever reason you cannot directly deploy (using Visual Studio WebDeploy) to a virtual directory in IIS.  This threw me for a bit until I created both the virtual directory, a separate website, and pointed them both to the same directory.  Then you just deploy to the otherwise unused website, and your web application shows up in your virtual directory


12
Dec 14


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.