|
ModeSix posted:The connectors are quite well done ModeSix posted:it won't store strings longer than 256 characters This type of "oh it works great, except for the front falling off" attitude is something I see a lot in recent times with the new .NET and the .NET Core things. It boggles my mind how such mass hypnosis is possible.
|
# ? Dec 10, 2016 18:34 |
|
|
# ? Jun 7, 2024 12:36 |
|
raminasi posted:Maybe I'm misunderstanding, but that comparator smells wrong, specifically: using the one field for equality but not comparison. When you're implementing a comparator, equality is when an object is neither less than nor greater than another object; shortcuts via object identity can lead you off cliffs.
|
# ? Dec 10, 2016 19:00 |
|
darthbob88 posted:Yeah, but on the other hand I want the comparator to return equal if two objects are the same, not just if they have the same product. {x=4, y= 10} is not equal to {x=2, y=5}, even though x/y is the same for both. Plus, AFAIK GUIDs are useless for anything other than equality. But you still need to provide some ordering of two objects with different GUIDs but the same product, and if you haven't thought about it specifically, your code might be doing something arbitrary, which could explain your problem.
|
# ? Dec 10, 2016 20:09 |
|
EssOEss posted:This type of "oh it works great, except for the front falling off" attitude is something I see a lot in recent times with the new .NET and the .NET Core things. It boggles my mind how such mass hypnosis is possible. I've been willing to deal with churn and brokenness for a bit because untangling .NET from Windows and getting things like ASP.NET Core onto NuGet and out of the framework itself will be worth it in the long run. I expect things will start settling down after VS2017 and .NET Standard 2.0, if they don't then yeah probably time to reevaluate how much time I want to invest in this stuff.
|
# ? Dec 10, 2016 20:39 |
|
raminasi posted:But you still need to provide some ordering of two objects with different GUIDs but the same product, and if you haven't thought about it specifically, your code might be doing something arbitrary, which could explain your problem. Yes, having a non consistent sort could definitely have that sort of result.
|
# ? Dec 10, 2016 21:18 |
|
raminasi posted:But you still need to provide some ordering of two objects with different GUIDs but the same product, and if you haven't thought about it specifically, your code might be doing something arbitrary, which could explain your problem.
|
# ? Dec 11, 2016 03:08 |
|
Speaking of .NET Core, since ASP.NET upgraded to 1.1 it now takes 1 minute to build my project (when it only took seconds before). Some people on the corefx GitHub repo said they had the same, and removing the reference to the framework SDK in global.json fixed the problem, but not for me. Before I open an issue there and look stupid, does anybody have any suggestion as to how I could fix/investigate this?
|
# ? Dec 11, 2016 09:08 |
|
Use Process Monitor to find out what exactly is happening during that missing minute. It shows all the filesystem operations done by apps - while it may not be related to filesystem, getting an understanding of where the delay lies in the app's lifecycle can give useful hints to solving the problem.
|
# ? Dec 11, 2016 09:10 |
|
EssOEss posted:This type of "oh it works great, except for the front falling off" attitude is something I see a lot in recent times with the new .NET and the .NET Core things. It boggles my mind how such mass hypnosis is possible. Your example is pretty heinous, however my issue could be that I am not implementing it correctly. I'm pretty new at using this ecosystem (maybe 3 months now) and still have a lot of learning to do. But what I've used is sure as poo poo a lot easier/better than the corresponding javascript framework answers (node.js/angular/react) for backend/frontend communication and authentication.
|
# ? Dec 11, 2016 15:02 |
|
EssOEss posted:This type of "oh it works great, except for the front falling off" attitude is something I see a lot in recent times with the new .NET and the .NET Core things. It boggles my mind how such mass hypnosis is possible. I admit I don't fully understand how this stuff all clicks together, but isn't the connector a responsibility of the MySQL folks? Surely it has nothing to do with the .NET team or .NET Core?
|
# ? Dec 12, 2016 11:29 |
|
I've had problems with the MySQL connector myself when using .NET Core. Works fine on Linux but on Windows I get lots of issues (like connection pooling not working) so I just switched to pgSql for development (I'm going through an ORM so it doesn't make much difference to me at this point in the development process) and now it's all great.
|
# ? Dec 12, 2016 12:45 |
|
The Wizard of Poz posted:I admit I don't fully understand how this stuff all clicks together, but isn't the connector a responsibility of the MySQL folks? Surely it has nothing to do with the .NET team or .NET Core? I'm pretty sure this is correct actually.
|
# ? Dec 12, 2016 16:16 |
|
The Wizard of Poz posted:I admit I don't fully understand how this stuff all clicks together, but isn't the connector a responsibility of the MySQL folks? Surely it has nothing to do with the .NET team or .NET Core? It's the attitude to accepting broken code as normal that I associate with .NET Core.
|
# ? Dec 12, 2016 16:30 |
|
ModeSix posted:I use it (.net core only) with MySQL and Postgres. The connectors are quite well done and easy to implement, at least in my experience. Is there something I don't know that I should be aware of? EF was built with SQL Server in mind, and afaik it's the only provider that's actually maintained by MS. The providers that communicate with other databases like Postgres or MySQL will work in 99% of cases (selects, wheres, etc.), but it's when you get into weird edge cases things can fall apart (special indexes, complicated aggregation queries, etc.). The situation has likely gotten better since I last played with it. The main difference is that I have confidence that all EF features will work with SQL Server, but it's not guaranteed for other databases.
|
# ? Dec 12, 2016 16:34 |
|
Now that you can get SQL Server for Linux I might just switch to that honestly. Is there any downside to use SQL Server vs MariaDB/PostgreSQL if you don't care whether or not the code is open source?
|
# ? Dec 12, 2016 16:38 |
|
EssOEss posted:It's the attitude to accepting broken code as normal that I associate with .NET Core. I kind of expect stuff to break when big changes happen, but I also see how it's pretty weird for official .Net libraries to have so many issues
|
# ? Dec 12, 2016 16:53 |
|
So I am reading up on .NET Core 1.0 and everything seems very positive when compared to ASP.NET Core 1.0 . Everything I am reading generally just views .NET Core as clearly better than ASP.NET Core 1.0. Maybe I am just paranoid but there has to be some downsides besides having to learn some new right? http://www.mithunvp.com/difference-between-asp-net-mvc6-asp-net-mvc5/ https://infogr.am/difference_between_aspnet_mvc_5_and_aspnet_core_mvc_10
|
# ? Dec 12, 2016 17:52 |
|
Furism posted:Now that you can get SQL Server for Linux I might just switch to that honestly. Is there any downside to use SQL Server vs MariaDB/PostgreSQL if you don't care whether or not the code is open source? Does "don't care whether or not the code is open source" include paying potentially lots of cash for licenses? Feature-wise, both MSSQL and Postgres have sexy features that the other one doesn't (say, temporal tables vs JSONB columns) but you might not be interested in either. Comparing major RDBMSs in general is an extremely complex affair, since they're practically heavy industrial machinery even if you happen to be using them for running trivial CRUD statements over tiny sub-GB databases. This could be a good place to start I guess? It's aimed at OLTP but I'm kind of assuming by default that that's what you're doing. NihilCredo fucked around with this message at 21:31 on Dec 12, 2016 |
# ? Dec 12, 2016 21:27 |
|
EssOEss posted:It's the attitude to accepting broken code as normal that I associate with .NET Core. Those people are everywhere, it has nothing to do with any specific language. Look at the poo poo PHP devs and JavaScript devs put up with.
|
# ? Dec 12, 2016 22:14 |
|
Calidus posted:Everything I am reading generally just views .NET Core as clearly better than ASP.NET Core 1.0. Do you mean ASP.NET MVC 5 vs ASP.NET Core 1.0? ASP.NET Core 1.0 is a library that runs on .NET Core 1.0. If so, I think that ASP.NET Core is pretty much just better if you're starting a new web application; the big problem is just that it isn't compatible.
|
# ? Dec 12, 2016 22:21 |
|
Asymmetrikon posted:Do you mean ASP.NET MVC 5 vs ASP.NET Core 1.0? ASP.NET Core 1.0 is a library that runs on .NET Core 1.0. If so, I think that ASP.NET Core is pretty much just better if you're starting a new web application; the big problem is just that it isn't compatible. Yes, they keep messing around the with names. http://www.hanselman.com/blog/ASPNET5IsDeadIntroducingASPNETCore10AndNETCore10.aspx
|
# ? Dec 12, 2016 22:57 |
|
I've got an ASP / MVC web application. In every single cshtml view, we us this pattern: code:
It is always Post, never Get. So basically everything it the application does will be done via a Post request, right? But what about if a JavaScript file contains a method which makes an AJAX request where the type is defined as Get? Basically my concern is this: I'm learning to use a Code Analysis tool on our application and I've got hundreds of these warnings that say any given method in a controller is susceptible to a CSRF attack, and they recommend : 1) Add the [HttpGet] attribute to the method in question. OR... 2) Add both [HttpPost] and [ValidateAntiForgeryToken] So my question is, if the form in the view is defined as post, does that matter for which attributes I apply to the controller's methods? I'm not really sure what I should be doing. I suppose probably add the appropriate request-type attribute depending on what the type is in the actual ajax call in the JS? This is going to be a long, tedious next month if so. I've got thousands of these warnings from the Analyzer...
|
# ? Dec 14, 2016 22:29 |
|
darthbob88 posted:I did think about it specifically, and it is doing something arbitrary. Can't fix it right now, but that probably is the issue. Thx.
|
# ? Dec 15, 2016 00:47 |
|
Sab669 posted:I've got an ASP / MVC web application. Unless I'm misunderstanding the situation, you want [HttpGet] on the action that initially DISPLAYS the form. [HttpPost] and [ValidateAntiForgeryToken] go on the action that the form SUBMITS TO. Is that all you were after or have I misunderstood? Happy to clarify if I can.
|
# ? Dec 15, 2016 08:06 |
|
I think that's it. Suppose I'll just have to try it out and see if I run into any problems.
|
# ? Dec 15, 2016 12:39 |
|
You should also only POST to forms that modify data, so probably not a search form, for example. Not everyone thinks this, but some people just like to be wrong
|
# ? Dec 15, 2016 16:03 |
|
Munkeymon posted:You should also only POST to forms that modify data, so probably not a search form, for example. Not everyone thinks this, but some people just like to be wrong Whats the rationale behind this?
|
# ? Dec 15, 2016 16:25 |
|
Mr Shiny Pants posted:Whats the rationale behind this? It's certainly a debatable rule, and it would largely depend on how your search functions. That being said, the POST verb from a pure REST perspective is only used to create an item(s) and is not idempotent. A search would be idempotent and safe (can be replayed by the browser, e.g. 'Back/Forward'), so it should be a GET. Ideally, this would be reflected in the URL bar as well, so that one could bookmark or send a search to someone else.
|
# ? Dec 15, 2016 16:57 |
|
You can also hit refresh without the browser pestering you about form re-submission because POST is assumed to be unsafe and GET safe, as B-Nasty mentioned.
|
# ? Dec 15, 2016 17:05 |
|
B-Nasty posted:It's certainly a debatable rule, and it would largely depend on how your search functions. That being said, the POST verb from a pure REST perspective is only used to create an item(s) and is not idempotent. A search would be idempotent and safe (can be replayed by the browser, e.g. 'Back/Forward'), so it should be a GET. Ideally, this would be reflected in the URL bar as well, so that one could bookmark or send a search to someone else. Thanks, makes sense.
|
# ? Dec 16, 2016 09:00 |
|
I keep seeing this piece making the rounds recently, lots of sites re-posting it. http://www.yegor256.com/2016/12/13/mvc-vs-oop.html I know this isn't strictly a .NET issue, but I was wondering what you guys make of it. I sort of see what he's getting at, but I don't think that using MVC necessarily stops you from applying good OOP principles. I like to build a well encapsulated core application and expose the behaviour of it to my controllers, rather than having the controllers manipulate the data directly. Keeping the controls thin and the domain model rich, basically. I think this dude's making the common mistake of thinking of the model as just the data, rather than all the behaviour and business logic too. chippy fucked around with this message at 11:55 on Dec 16, 2016 |
# ? Dec 16, 2016 11:50 |
|
The issue arises from people thinking that MV(C/VP) is a complete application architecture instead of just being an architecture for your UI layer.
|
# ? Dec 16, 2016 15:12 |
|
chippy posted:I think this dude's making the common mistake of thinking of the model as just the data, rather than all the behaviour and business logic too.
|
# ? Dec 16, 2016 19:28 |
|
chippy posted:I think this dude's making the common mistake of thinking of the model as just the data, rather than all the behaviour and business logic too. I don't really blame him for thinking this, either. Most official and unofficial tutorials and getting-started style examples put all the logic in the controller (because the logic is so simple) and the only thing that goes in the model is the database objects (often EF entities). They focus on explaining all the .NET-specific MVC stuff like where you configure routes and what all the Attributes do, and don't sufficiently emphasize or define what the Model should really be. It took me a while to clear that mental block.
|
# ? Dec 17, 2016 20:13 |
|
This is sort of a dumb question, but is there any consensus on whether or not you should always include a default case in a switch statement? For example, in the following code would (should?) you add a default case? code:
We should never not hit one of our defined cases, so why bother? Sab669 fucked around with this message at 17:59 on Dec 19, 2016 |
# ? Dec 19, 2016 17:08 |
|
Sab669 posted:This is sort of a dumb question, but I'd there any consensus on whether or not you should always include a default case in a switch statement? I would include it just to ensure it throws a WhatTheFuckJustHappenedException. If someone makes it i < 5 and doesn't add a case for it, I'd rather immediately know than have it fall through.
|
# ? Dec 19, 2016 17:12 |
|
Right. The idea is not to do some "default action" that is supposed to make sense but to raise the alarm because some other part of the code was changed without the appropriate modification being done to the switch statement.
|
# ? Dec 19, 2016 17:44 |
|
Good point. Working my way through the thousands of items found by these static code analyzers and there were ~60 switches with no default. I suggested to my boss simply just throwing an exception, if no "obvious" logic should be done, but I wasn't sure if there was any official MSDN guidelines or anything.
|
# ? Dec 19, 2016 18:03 |
|
Not having a correct or expected value is an exceptional case, and I would much rather have that fail loudly than to silently misbehave.
|
# ? Dec 19, 2016 18:07 |
|
|
# ? Jun 7, 2024 12:36 |
|
chippy posted:I think this dude's making the common mistake of thinking of the model as just the data, rather than all the behaviour and business logic too. In MVC the model actually is just the data, but the thing he's missing is that for a proper application you would also have various services to handle business logic rather than lumping it all in the controller. john donne posted:The issue arises from people thinking that MV(C/VP) is a complete application architecture instead of just being an architecture for your UI layer. This explains it better than I can. I usually even use two projects (or more). One that is just my MVC project and just has models, views and controllers, then I build services in a separate code library project (in the same solution) and reference it, and that's where all the business logic sits. So a "create post" controller action might look something like: code:
putin is a cunt fucked around with this message at 00:48 on Dec 21, 2016 |
# ? Dec 21, 2016 00:44 |