Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Calidus
Oct 31, 2011

Stand back I'm going to try science!
I generally just gave up on WPF when trying to switch form WinForms, and went straight to MVC web apps.

Adbot
ADBOT LOVES YOU

Calidus
Oct 31, 2011

Stand back I'm going to try science!
When you're responsible your writing and deploying applications, managing one internal IIS server become much better than dealing with desktops.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I got into a stupid discussion on mvc today. The specific topic was whether using LINQ lambdas on a list to get a scalar value should be done in a view or in the model.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Our third party order entry system uses SQL server on the backend(database A). I have number of table valued functions which I use to generate reports using a internal MVC web app, the web app calls them directly with System.Data.SqlClient. The web app has it's own database(B) and I use Entity framework, LINQ and lambas to make my life easy. I current have all those table valued report functions stored in database A. Is there any down side to moving all those functions to database B and adding them to the entity framework for easy of use?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Is there a good resource for using json, ajax and js with MVC and .Net? I have been doing some MVC development off and on but it was mostly bootstrap html/css for the views and c# on the back end. I feel kind stupid when i come across simple stuff like using json and an ajax get for cascading combo-boxes which would have made my life so much easier months ago. Ajax partial page post backs were also a eye opener. There has to be a resource with more stuff like this.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I have a MVC webpage which is used to add items to an order. Think of it like a stupid version of those design your own car webpages every manufacture has now. It has 3 sections, the first section is html form with some inputs used to select and add an single item to the order. The second section is a preview image rendered by the server based on uses current order. The third section is a second html form which is used to remove a previously added part from the order. This is clunky as hell with two different html forms being posted.

I am thinking I have a few ways I think I could make this better:

  • I could change the page to use MVCs Ajax partial postbacks and just refresh the sections that need refreshed
  • I could also try and use a single form with multiple submit buttons
  • I also use Json results, JS and Ajax to update each individual parts of my model and my complex session variable.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I know this might be pure convention, is it proper in .NET MVC and in MVC design in general to have a view that just consists of other views? I have 3 partials views which I want to display on a single page, do I make a "wrapper" view and just call each of the partials, or do I promote on of the partials to a full view. On one hand is kinda seems like useless junk but on the other I can see it being nice.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I might be completely insane for even thinking this is possible but here it goes. Could a template in VS take a c# class and create a matching Controller.

I would like to turn this:
code:
	public class foo{
		public string myString(string input){
			//do stuff
			return string
		}
		public int myInt(int input){
			//do stuff
			return int
		}
	}
Into something like this:
code:
	public class fooController :Controller{
		public JsonResult myString(string input){
			var myFoo = (fool)Session["myfoo"];
			return Json(myFoo.myString(input));
		}
		public JsonResult myInt(int input){
			var myFoo = (fool)Session["myfoo"];
			return Json(myFoo.myInt(input));
			
		}
	}

Calidus
Oct 31, 2011

Stand back I'm going to try science!

GrumpyDoctor posted:

Not statically, I don't think. You'll need runtime shenanigans (either with dynamic or reflection).

F# could :eng101:

RICHUNCLEPENNYBAGS posted:

I dunno about with Visual Studio but I solved a similar problem by using reflection and a StringBuilder and TagBuilder to build up Angular HTML views and JavaScript services to talk to my WebAPI controllers. So sure, it's possible to do.


Thank you both for the suggestions. I have an ugly winform app, that I have managed to strip out most of the business logic into its own project. I would like to use that business logic to create a single page web app(maybe 3 pages at most) to replace it. I figured wrapping everything in json would a good place to start.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
So am I missing anything?

  • Win10 runs iOS and Android with App-V
  • .Net Core5 allows ASP.NET 5 to run on Linux and OSX.
  • Windows Universal Apps allows a single application to run on Windows desktops, tablets, phones, xbox and halolens
  • Visual Studio can debug Android and iOS apps
  • ASP.NET 5 will not support Web Forms
  • ASP.NET 5 will not support VB
  • VS2015 has templates for AngularJS

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Could I split out my entity frame work edmx model and various classes into its own project and use that project in multiple solutions? How would that work with config files? I would like to be able to refuse my entity model from my MVC site on a couple of desktop solutions.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Can't you just do a basic event handler to check if enter is keydown and textbox has focus? Couldn't you also just do text.TrimEnd(new char[] { '\r', '\n' }) on textbox change event if you want something simple and kinda hackish?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Does this seem sane and do able? It would be nice to know if I am being a complete moron before I start coding. Right now I have everything functioning in a single terrible for loop that takes 1 to 15 minutes to completes depending on the how many items get posted back to the server.

code:
Thread 1  -> Receive Post on MVC Controller -> redirect to index page 
		|Thread 2 -> For Loop to create threads for each new File -> wait for child threads to finish -> log result in database -> thread closed
				|Thread 3-> Create PDF File 1 -> Email PDF File 1 -> Log result in database -> thread closed
				|Thread 4-> Create PDF File 2 -> Email PDF File 2 -> Log result in database -> thread closed
				|Thread 5-> Create PDF File 3 -> Email PDF File 3 -> Log result in database -> thread closed
				etc

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Thanks for the reply that makes a lot of sense, the simple web application kinda ballooned over time. I used rotativa (wkhtmltopdf C# lib) generate some simple pdfs of invoices then it kinda transformed into creating 100 page pdfs over time. If I am going to making a background service is it best to have one service per website or compartmentalize them even more? One service for file creation, one for emails, one for faxes, etc?

Calidus
Oct 31, 2011

Stand back I'm going to try science!

fleshweasel posted:

Are there any trip reports out there of people's experience working on ASP.NET projects with Visual Studio Code?

It use it to edit config files, I fire up VS for just about everything else.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
If I want to mess around with AngularJS and MVC, is it best to just to wait for ASP.NET 5 to be released?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
If your file server is a windows 7 box why just write a stupid little web app to run on IIS?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Just an FYI, it seems Nuget in VS2015 doesn't seem auto checkout nuget.config from source control, and if it can't write to the file it just crashes and writes an error to the activity log. It also seems when you update which version of MVC you are using it does not update web.config in the Views folder.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

ljw1004 posted:

Calidus, I wonder if you're experiencing the same as this? https://github.com/NuGet/Home/issues/985

It'd be awesome if you could go to that issue page and add your report (plus repro steps) to the issue. That way the NuGet team will know the issue's serious.

Yep that seems to be exact the issue i was dealing with.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Is there an easy way to find all the references/links to a view in a project? I have 10 views which are basically duplicates of 3 views. I would like to clean up those 10 views, but I don't want to miss a existing link that is coded into some other view.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I am trying to use the MVC Entity scaffolding to create a some pretty standard views in VS2013 Update 5, but I keep getting: There was an error running the selected code generator 'Object reference not set to an instance of an object.' It seems to happen on all my classes. It is driving me batty, I have reinstalled Entity and reinstalled MVC in my projects and I repaired VS2013. I have WebTools installed. I even tried creating a new solution with a entity model and the mvc starter code but it still failed. The same thing also happens in VS2015.



edit: I have tried it on a coworkers machines and I get the same issue, so I guess it must be something with my solution/project.

Calidus fucked around with this message at 23:32 on Jul 31, 2015

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I have given up on my issue. Has anyone tried using Win10 as a .Net Dev environment yet?

Calidus
Oct 31, 2011

Stand back I'm going to try science!

EssOEss posted:

I am using Windows 10 with great success so far. No complaints. Anything specific you are worried about?

I have to target .Net 4 and a couple of xp machines(yes it is terrible I know) just worried oddities nothing really specific.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

chippy posted:

So Intellisense has suddenly broken on all my Views in an MVC project. Suddenly the opening @model, ViewBag, and anything like ActionLink, DisplayFor are underlined, model and ViewBag 'do not exist in the current context'. The project still builds and runs just fine.

Anyone know how to fix this? I've restarted VS a load of times, nothing. All I was doing was editing and existing view when this happened.

edit: All the fixes I can find seem to centre around web.config. I didn't touch mine before it broke, and it looks fine by all accounts.

edit: Switched to a branch that definitely did not have the problem before, now has the problem. Thanks VS!

I would give a rebuild a try and possibly look into nuking your pdb files.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Anyone have experience with Visual Studio online? I want to put my visual studio 2010 installation out to pasture, but buying TF for 2 to 3 developers seems kinda stupid. I was also debating on switching over to git, this projects to immgrate looks pretty nice: https://github.com/git-tfs/git-tfs

Calidus
Oct 31, 2011

Stand back I'm going to try science!

No Safe Word posted:

git-tfs is pretty decent but if you have a fair amount of branch history and/or have done any nontrivial branching/reparenting or otherwise futzing with the hierarcy, git-tfs will straight up fail. I wanted to do the same but just couldn't. But if it's a relatively simple repository, it works quite well.

Everything I have is pretty simple, it is basically 15 small projects each with Dev, Main and ReleaseX.X.X.X branches.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

Ithaqua posted:

I have extensive experience with VSO (it's a big part of my job). VSO is awesome. Work management, SCM, build, release, testing, and soon package management all integrated together is rad.

There's Git-TF and Git-TFS, both of which work pretty well for migrating TFVC repositories to Git. However, keep in mind that VSO supports (or will soon support, I forget which) Git and TFVC repositories hosted in the same team project. The options to migrate source code with history from on-prem TFS to VSO are okay, but not perfect -- look at the OpsHub migration utility.

I'd recommend giving consideration to why you're switching to Git. If the team already has Git experience, or if the advanced workflows enabled by Git are something your team needs or wants, then go for it. If they're unfamiliar with Git and are perfectly content using TFVC, don't switch for no reason. I see tons of teams get into trouble by cargo-culting their way into Git, trying to use it like a centralized VCS, and being miserable.

Right now we have two developers including myself. Management likes using Basecamp for project management because it is stupidly simple and it integrates with Highrise(CRM). So we never really used the Workflow functions of TFS. I was mainly looking at Git because source control is the only thing we use TFS for 99% of the time right now.

Online would be nice just for the added benefit of it is one less thing I have to backup locally. Maybe I will give it a go mess around with VSO for a while and see how it works.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
On the topic of windows 10, is it safe to do .net 4 development on a windows 10 machine? I would really like to upgrade my work machine from 7 but I am kinda nervous windows 10 might jack up my development environment.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

kingcrimbud posted:

Why would a sql query generated from Entity Framework take minutes to execute, yet when the same query is run within SSMS, it takes less than a second?

Entity Framework 6.1.3
SQL Server 2005 Enterprise

I'm grabbing the sql generated using the Infrastructure Interception DatabaseLogger registered in web.config. I'm unable to trace or profile in SSMS due to a current lack of permissions so I don't have any other details yet.

Are you by chance doing a insert? In my experience entity inserts are terribly slow. Entity also seems to take a larger performance hit do to missing keys and indexes than raw sql.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Years ago I made a lovely drupal website on an aws micro instance, I don't know enough php do what I want and I don't really want to learn php. Are there any .net CMS that are easy to interact with and expand? I have a couple MVC sites that developed and deployed to IIS. Umbraco seems pretty nice.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Anyone ever had to use the QuickBooks .NET API/SDK? General thoughts? Easy to use?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Is it bad practice to store user information in session variables? I just realized how many times I look up basic user information in the database and I was thinking about keeping basic things like company id, company route and company discount in session variables so I don't need to query the database all the time.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

The Wizard of Poz posted:

I have an MVC5 project that I'm working on that, after receiving a file upload, has to notify a person by email that the upload has occurred. I want to hand this off to a separate process so that the user can get the HTTP response back and continue on their way without waiting for the email to send, since it's not a critical part of the process from the user's point of view and there's no reason they should wait.

I think the key lies in the asynchronous features of C# but I have literally no exposure to this and I don't really have the time to fully grok it right at this moment. What I kind of need for now is a basic introduction with maybe a clear example - does anyone know a good resource for this?

I did something similar with a console app and a SQL table that I treated like a Queue. Every time the MVC site needs to send an email to just write a row to the table. Then I the console app was setup to run every X minute(s) via the task scheduler. It is nothing fancy but works well, and the separation is nice for troubleshooting.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I have a Solution that contains a MVC 5 project, a business logic project and DAL project. When I try use the MVC scaffolding with my entity frame work objects in my DAL project I keep getting “Object reference not set to an instance of an object.” The MVC project has a reference to my DAL project. I tried creating a test db context inside my MVC project and I got the same error. This is driving me up a wall. I am using VS2013.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

Calidus posted:

I have a Solution that contains a MVC 5 project, a business logic project and DAL project. When I try use the MVC scaffolding with my entity frame work objects in my DAL project I keep getting “Object reference not set to an instance of an object.” The MVC project has a reference to my DAL project. I tried creating a test db context inside my MVC project and I got the same error. This is driving me up a wall. I am using VS2013.

Encase anyone else runs into this terrible poo poo. I had to uninstall EF from all of my projects and after reinstalling it I error about missing meta data and being unable to find the CLR for a class. Turns out that classes mapping was messed up in my EDMX model. The really confusing part is that model wasn't even the one being used to created a controller and seemed to work when using it for LINQ and Lamda functions.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
fsharpConf 2016

https://channel9.msdn.com/

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Entity Framework Question: What is the advantage of using EF Designer from Database apposed to Code First From Database?

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I am terrible hack who just writes ugly code than has ReSharper pretty it up for me.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

Cuntpunch posted:

I'm going to presume you are using the strict literal sense of 'EF Designer from Database'(aka the project template name) - where you are functionally doing a Database-first approach - and not a designer-first to generate both code *and* DB.

That being said, it sure is helpful if you already *have* a database set up and just need to hook EF into it?

Yes if you already have your database and you want to hook EF into to, VS has two templates to do that. I am trying to figure out which one better suits my needs.

Adbot
ADBOT LOVES YOU

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Is there anyway to prevent the EF templates from overwriting modified classes? I have added constructors to the majority of my class I don't want those changes getting nuked every time I run update model from database.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply