9 ms·
.NET Core 1.0 release – what you need to know to get started
- jsmith0295 10y agoI really wanted to give this a try, but the lack of first-class MySQL support makes it a non-starter for me at this point. There are third party drivers, but they don't seem to work with many Entity Framework features.
- cdmckay 10y agoIsn't this a first-party driver? https://dev.mysql.com/downloads/connector/net/6.9.html https://dev.mysql.com/downloads/connector/net/6.9.html
- jsmith0295 10y agoThat's for EF6, which only runs on Windows. Can't use Windows servers where I work.
- justinmk 10y agoTrust me, you don't want EF--no matter how many times they say "vNext is gonna be great!!1 for real this time." Consider a micro-ORM like dapper[1]. [1] https://github.com/StackExchange/dapper-dot-net https://github.com/StackExchange/dapper-dot-net
- gnaritas 10y agoYes yes yes, but better yet, write your own. Micro ORM's are "micro", it's pretty trivial to create something better than Dapper and there's no framework in the world better than your own, to you, because there won't ever be anything to complain about, just mold it to work exactly how you like. Dapper.. var dogs = connection.Query<Dog>("select Age = @Age, Id = @Id", new { Age = (int?)null, Id = guid }); yuk, I prefer var dogs = Dog.FindAll(And(IsNull("Age"), Equal("Id", guid))); A touch of generics done properly, a bit of reflection, a static import, and you can do much better than onnection.Query<Dog>. Write the API you want, implementing what is basically an active record without relationships is not terribly difficult and will pay off for years to come in your own code. Edit: Dappers API is ugly as fuck, that's an immediate non-starter for me, and the cost of reflection on loading objects is the wrong problem to be optimizing and would only show up in an absurd micro benchmark intended to show off speed that doesn't matter, it's small compared to the execution time of the queries. If you like it, use it, but lets not pretend it's so much effort it isn't worth redoing. It's certainly not the end all be all of ORMs.
- justinmk 10y agoNo, there's no (technical) reason to redundantly solve the problems that dapper has solved. In particular the emitted IL which avoids costly reflection is not something many people will correctly re-implement. > A touch of generics done properly, a bit of reflection, Dapper avoids reflection, its performance is very close to a hard-coded SqlCommand.
- gnaritas 10y agoIf you're worried about the speed difference between reflection and a hand written command, you're spending your time in the wrong part of the code. Reflection isn't the bottleneck, the database is, by far. Yes, if you speed test the difference between reflection and handwritten, it'll look slow, but such micro-benchmarks are unrealistic of production code. If you look for slowness you'll find it everywhere you look, but if you profile real code you'll find the only slow code that actually matters and you'll find that database IO is the bottleneck generally.
- mythz 10y ago> var dogs = Dog.FindAll(And(IsNull("Age"), Equal("Id", guid))); That's pretty ugly and not idiomatic for .NET which favors using typed LINQ providers for data querying. We develop OrmLite, a fast, code-first POCO ORM which lets you use LINQ to query and map to clean POCO's so you could instead query the above with: var dogs = db.Select<Dog>(x => x.Age == null && x.Id == guid); You can see more OrmLite features and try them out "live" with just a browser with the Interactive Tour on: http://gistlyn.com/ormlite http://gistlyn.com/ormlite
- gnaritas 10y ago:) Well, it's pretty ugly now that expressions exist, however prior to expressions it was quite nice since S expressions is all they are and I've had this for nearly a decade in .Net, long long before such niceties like expressions existed. And I'll just bolt expressions into my library when I feel like it and type this var dogs = Dog.FindAll(each => each.Age == null && each.Id == guid); rather than relying on an external dependency that doesn't work the way I want. The need to do this... db.Select<Dog> Use generics at the method level, I find intolerably ugly when you could have created db with said type and have access to an already typed API. What you're doing there, I personally consider bad design and would refuse to use. When I use a typed list... I don't go someList.Add<Thing>(aThing) Because the decision to type the list was done at list creation time. Forcing me to pass a type on every call to the db, less than attractive. The best uses of generics don't look like you're using generics because you only have to do this once class Dog : Persistable<Dog> {} To have a perfectly typed class side API that doesn't shit generics all over the client side code. The T is specified once and only once, and never seen again and now all the Select/Save/Delete/Create methods no longer require the client to constantly type <Dog> every time they touch your lib. In all fairness however, it would be trivial to wrap your lib in a persistable template and achieve exactly the API I wanted, should I ever desire to do so. Which is actually a much better argument for using your lib than any you've given.
- taspeotis 10y agoPick the right tool for the job. EF works great for us for OLTP workloads. OLAP workloads: choose something else.
- baconner 10y agoYeah I don't see why you would want any kind of orm for olap, not just EF.
- jsmith0295 10y agoI tend to prefer things which are more lightweight, but my coworkers don't. I'm mostly wanting to pitch this as a better alternative to Spring Boot and JPA.
- matthewking 10y agoCurious what shortcomings you're finding in Spring Boot that Dot Net Core would solve?
- spriggan3 10y agoFinally ! Goodbye php,ruby and go ! can't get rid of Python though, simply the best language for analytics.
- JoelBennett 10y agoJust out of curiosity, have you looked at F#? (I use Python at my day job, and C# on my own side projects at home. F# seems... interesting).
- nxh 10y agoWhat are the biggest benefits of using NET Core in comparison with Go, Ruby, Python?
- gnaritas 10y agoSpeed of course, and a huge standard library that works with multiple languages, Ruby and Python are dog slow compared to C#; can't speak to Go, haven't used it.
- mattmanser 10y agoCore doesn't actually have a huge standard library. That's kinda the big problem with it. It's basically, at the moment, a really shit version of .Net 4.61. For example in the 1.0 release the ORM is a complete joke at the moment. It can't do fairly basic stuff, like worse than ORMs from 10 years ago.
- richman777 10y agoEntityFramework? In my 5 or 6 years with .NET I've had more problems with EntityFramework than not. Most of the time it's overkill or just not optimized for the queries I could write myself. I'm a huge fan of Dapper.Net. Looks like there's initial support for core as well.
- mattmanser 10y ago
- meira 10y agoNow is the time, Microsoft. Go for it!
- dblooman 10y agoAre there any guides for OSX/Linux that don't end with printing hello world. A lot of what seems to be out there is very basic or starts talking about Windows when it starts to get interesting
- mjgoeke 10y agoToo bad the tooling (e.g. restore, build, package) and (I think) the project files format is still preview. So far, my experience has been that small isolated project seem to work fine, but as soon as I try to break a more complex solution out into separate nuget dependencies things start to get hairy. Nuget dependency versions don't support npm-like syntax, so you can forget about the "^1.0.0.0" notation. Syntax like "[1.0.0.0-2.0.0.0)" might be supported, but honestly I've been fighting with other issues enough that I can't recall for sure if making the version syntax ugly makes it happy. Another surprise to those from javascript/npm land is multiple versions of the same library in your dependency tree isn't supported. So you basically need to support redirecting to a commonly supported version (which, without examples showing version ranges, you're back at the version range syntax pains). If anyone's tackled these pain points I'd love to hear.
- soulnothing 10y agoI'm new to the CLR build system myself, and have sort of gotten stuck on project formatting. The F# side seems to have some newer build systems, and are trying to go towards a simpler build/project system. For dependencies see Paket[1]. It allows versioning, and only the parent dependencies not the entire dependency tree. For building much like Gradle there is FAKE [2]. It's an F# DSL for build tasks, and has type safety etc. But I've seen examples with C# project as well. [1] https://fsprojects.github.io/Paket/getting-started.html https://fsprojects.github.io/Paket/getting-started.html [2] http://fsharp.github.io/FAKE/ http://fsharp.github.io/FAKE/
- cylo 10y agoI haven't been able to reliably/easily get a project to compile on Linux into a self contained executable similar to Go. At one point this was advertised in blog posts as something that would be possible. Has this changed? I think it's one of the killer features that help ease the burden of deployment for a lot of folks.