Entity Framework Tooling with Erik Ejlskov Jensen - podcast episode cover

Entity Framework Tooling with Erik Ejlskov Jensen

May 11, 202359 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

How do you do more with Entity Framework? Carl and Richard talk to Erik Ejlskov Jensen about his work contributing to Entity Framework and creating tools to make Entity Framework easier to use. Erik talks about how EF has continued to evolve, including some significant performance optimizations. The conversation also explores code-first vs. database-first - although Erik falls firmly into the schema-first mindset. There's more coming for Entity Framework; it's worth your time to get the most from it!

Transcript

How'd you like to listen to dot net rocks with no ads? Easy? Become a patron For just five dollars a month you get access to a private RSS feed where all the shows have no ADS. Twenty dollars a month will get you that and a special dot net Rocks patron mug. Sign up now at Patreon dot dot net rocks dot com. Hey Carlin Richard here. As you may have heard, NDC is back offering their incredible in person conferences around the world, and we'd like to tell you about them. NDC Oslow will

be me twenty first through the twenty fifth. Go to NDC Oslo dot com to register. NDC Copenhagen is happening August twenty seventh through the thirty first. The early bird discount for NDC Copenhagen ends June second. Go to NDC Copenhagen dot com for more information. NDC Porto is happening October sixteenth through the twentieth. The early bird discount for DC Porto ends July twenty first. Go to EDDC Porto Do calm to register and check out the full lineup of conferences at

NDC Conferences dot com. Welcome back to dot Net Rocks. This is Carl Franklin and this is Richard Campbell in our respective corners of North America. How are you doing, buddy? What's up? Raining? Lots of rain? Oh you know, at least it's not freezing. No, it's not freezing anymore, warmed up. Yeah, but yeah, you know it's spring season. How the bears come out yet? Oh? Yeah, no, the

bears are around, no question. We've actually had a full size mountain lion wandering around, evading fish and wildlife quite successfully, because they really don't like having ninety pound cats walking around the neighborhood. But yeah, yeah, I've got a good shot of her headed back into the backyard and into the forest behind me. But plenty of other neighbors gotten shots of her as well.

So you know that story about Roy Rogers and Dale Evans. Dale Evans got Roy Rogers a new pair of boots for Easter, and he went out hunting and he comes across this mountain line which jumped at him, and he pulled out his pistol and shot it dead. And but before before the cat died,

it just completely you know, fought. He had to fight it off, right, and and it tore the crap out of his boots, so he slings it over his back and he comes walking up the lane way and Dale Evans is on the porch and she says, part of me, Roy, is that the cat that cheered your new shoes. Oh man, that was a long way to go. Oh boy. Okay, well, anyway, let's start start to show. We'd better know framework this being episode eighteen

forty five. If you go to eighteen forty five dot pwop dot me, you will see a tweet from one McKay Wrigley and he says, Jarvis is now reality. My GPT four coding assistant can now build and deploy brand new web apps. It initializes my project, builds my app, creates a GitHub repo, and deploys it to versell all from simply using my voice. Cool, and he's got a video there And I just thought this was really telling.

And I remember, do you? You probably may or may not remember this because this might have been before you, but we were talking about automation and everything, and I was saying, you know, someday you'll be able to just walk up to a computer and have a conversation with it in regular language, and it will spit out a fully functional business logic included app or whatever. And whoever was on the line that day said, nah, that's

that's not going to happen. That'll never happen. And I don't know that it has happened, you know, I don't know that it has either. But air quotes fully functional. Like near as I can tell, you've managed to build a DevOps You put a chat interface on top of a DevOps engine. Okay, So are you saying that this is never going to happen? I think nevers a funny word, right, nice edge. Well, eventually the sun expands and incinerates the planet too, So right, what context do

you want never in? Okay? How about in our lifetime? Do you think some of you able to walk up to a computer have a conversation, you know, have the things say okay, what happens when they press this button and you say it and then it spits out let's say, ninety percent to a completed application. Yeah, we've already had that technology in our lifetime. It's just a question of was it good enough? Because it's also a moving goalpost, right right, once upon a time, as long as it

rendered eighty by twenty five texting a green screen. It was good enough. Yeah, right now, I expect it to be on a phone, on a tablet, on a PC, works in the cloud, works at home. Like, expectations keep shifting, so as long as that momentum is maintained, and one would argue we've been stuck in the same form factors for quite a while now, Yeah, I guess it also depends on the you know, the nature of the app. Right. If it's just forms over data,

I can see that happening. But if it's you know, got something that you need to hire a CSS guru for because it has to be pixel perfect, that's going to be hard. It depends on what the visualizations are. Yeah, it's going to be hard to describe it. But look at the chat interface on top of Power platform for forms over data, that where you can describe your intent. Yeah, yeah, that's pretty cool. Yeah, no, it's very exciting. Well anyway, that's when I got we

are very much in a hype cycle right now. Friendly, Yes we are, Yes, we are, all right. So I was talking to us today. I grabbed a comment off of show fifteen sixty six, so I'm going back a bit. That's the show we did in July of twenty eighteen with Corey House talking about graphs Quel, although we didn't talk a fair bit of any framework in relationship, it's too graph ql. And this particular comment comes from Mike Bateman who said, hey guys, long time listener, first

comment, and we only waited six years to read it five. I work for a big company building APIs where we do rest but not all the verbs. Nobody does all the verbs, O data and a little blend of both. I love this episode. It dug into issues we face as API builders and consumers. I'm glad that O data has been talked about again, as we been using it for years, both internally and externally. And my first impressions of graphql I thought it was a rip off of O data, which

is not that other thing. However, as I dug into the detail of graph QLL, I found it to be more mature, better supported. UI tooling is a massive help. The notification of description feature caught my attention to and this is five years ago. You know, graph QLs improved since then.

We have lots of sequel databases and any framework models coated up and using graphql dot Net library which made building graph qul service is much quicker and easier than o data and as for depth and intense quarrying issues, those existed no data two. We were hit on a Saturday afternoon with some crazy od data queries that actually took down our sequel servers. Always on a Saturday after right,

and that's the way that works. I'm sad that o data wasn't endorsed as much as graphql when it first came out, but I'm glad graph qul is here. I'm gonna encourage our fellow dot net devs to consider it when building an API. Xmel yea, no, thanks, no, thanks, Jason, Yes, please more of that. Please, it's great work and keep it up. Oh, great work to you too, Mike. Sorry

it took me five years reread it is gone because it's awesome. Yeah, yeah, and yeah it Isn't it fascinating how data is evolved and the way we're working these days, although it seems pretty stable at the moment, like we've got a good stack running with us, and props to Doug Crocfrot totally. Yeah. So, Mike, thank you so much for comment. And a copy of music Code Buy is on its way to you, and if you'd like a copy of music codey I read a comment on the website dot

at rocks dot com or on the facebooks. We read every one of them and we comment on a few, and when we read that comment, I'll send you a copy of music. Go buy hey, and definitely follow us on Twitter. That's all fine and good, but you should think about following us on mastadon because that's where the fun is happening these days. I'm at Carl Franklin at tech hub dot social and I'm at Rich Campbell at mastodon dot

social. Send us a tute. We like getting them. And you know, if you send us a tute that's a comment on the show, we'll read it, just like we do when you posted on facebooks and all that other stuff. Right, absolutely, all right, And with that, let me try to pronounce Eric's last name and middle name and not screw it up.

Eric's SkELL Jansen. How's that perfect? All right? He is a principal consultant at Delegate As He maintains a number of open source data access tools and libraries, including ef core power tools and sequel like Toolbox for Visual Studio and Multiple Entity Framework providers. He's been awarded Microsoft MVP fourteen times and enjoys running comic books and walking his dog. So do you run the comic books and walk the dog or do you walk the comic books and run the dog.

There's a comma there, I'm sorry, Leaves. Yeah, let's see grandma enough, Maybe I'm mast comma. Yes, thank you, Yeah, welcome to dot net rocks. It's great to have you. Recently, I brought up entity framework as being I made a joke about it being a rapper around some exception or something like that, and when and only because I have a little pain with and the framework, and I'm hoping that you might be able to help me answer the question that I have. But I'll get to

that a little bit later. First, why don't you introduce yourself and tell us about what you've been working unlately. Yeah, my name is as you said, and I work as a consultant and create apps in usually custom apps running in as your cloud based on native app services, and I frequently use a sequel server for those apps. It's believe it or not, it's actually

something that's still in use. Is everywhere. Man's never going away, I doubt it, and that's quite a good offering called as a sequel database, which is everything is completely managed for you. You don't need to do backups, you don't need to worry about high available because everything is already available in three copies, even for the for the cheapest stock keeping units and so on. I've actually taken advantage of that before UM where you know it's like damn,

I really need a backup of this database. Hey wait a minute, there, don't don't go looking. Yeah so yeah, so, And I often I like to be productive when I when I develop as well, and I think ef core, UM entity framor core can really help in that respect. And I have for the benefit of myself and in order to be even more productive, but also to help others, I have published some tools and some libraries to to help developers be more productive, for example e of core

power tools. So so, when ef core was initiated together with dot net core back in the day, I think that was like two thousand in seventeen sixteen. Round that time, the team didn't work on any graphical tooling because it was cross platform, so the effort was spent on on the run time and performance optimization and not on graphical tools for a particular platform, like Missile

Studio on Windows, for example. So I grabbed that opportunity to publish IF core power tools in agreement with the courteen because they didn't want to have anything to do with it. And it actually makes makes you able to very quickly start using your database, your existing database with ef cores by scaffolding the necessary classes and dB context mappings and so on, so so you can in a stronger type fashion, can communicate with your database from c shop. This was

obviously before that stuff was built Individual studio. Yeah, it's like in for the IF six classic, if you wish that was you could create an idio mix in visual Studio. But I mean that was also very much bound to Visual Studio and Windows and that whole infrastructure West dot net core was really aimed at being cross platform, of course, and addressing so we should be able to run on one all kind of other operating systems like Linux and Mac and

so on. And I know it's a little bit crazy, but they actually open sourced entity framework before dot net core, I know, I know, and and actually contributed to that as well at that time. And I think, I mean, I'm not sure. It was the first project that Microsoft really where they really embraced open source. I think it was a open source at the same time as ESPNT for something, but they really embraced open source in a in a in a good way. It was one on something called

cooplex. Yeah, remember, which was before get back exactly back in the day. But but yes, but the team was really open to towards contributions from from computer community members and was really helpful in providing guidance on how do I do this, because it's like they were using some weird source control system. It wasn't I can't remember now. It was their own internal one and

it was bizarre. Yeah, exactly. It was like like homemade pre gets something well, and and GitHub was the product that was the space that learned how to take contributors from externals and so forth. So when they were doing this or coplex, there really was no mechanism for that, Like if you

were part of that. That's a great story too, because they were most people that most of the groups that posted stuff on the coplex, they were building it internally and then we're just sort of pushing the thing up the CodePlex to take feedback. Yeah, they were never really trying to get code from that, but you actually we're trying to contribute back then. Actually somehow, Yeah, I was struggling, but somehow I managed to contribute. Yeah,

it's awesome. Yeah. Did you contribute to the code that we run now, the di scaffolding for Enity framework. I have contributed to the code that is running today, the scaffolding for interfaming and other features, but in particularly the scaffolding code I have contributed to because that is the basis I use for the visual tooling. That visual tools tooling is built on top of that. Wow. Of course I didn't didn't want to have to reinvent the wheel.

And the basic framework provides like each provider, Like a provider is something that advises a particular database system like Sequel Light, Sequel Server as a sequel, and the post quest and the Oracle whatever, and they each have the application to provide a model that describes the structure of a of a database that you pointed to. And so there's a common API for consuming a description of what the database schema looks like. Wow. So so each provider already supplies that

metadata mechanism and of course I'm I'm not. I don't want to reinvent anything basically, so so I'm using all those mechanisms that are built into the framework and building on top of that. To me, what was important about what became Entity framework ord the open source version of any framework, is that it's essentially the first time that Microsoft a Microsoft team took an existing closed source property and made an open source version from it, which seems impossible, like from

the inside. When they succeeded at that, it wasn't. It was the most important piece of code is that it was a mechanism that didn't wasn't believed to be possible because you know, a normal way that Microsoft builds code is they're covering it in patents all the time. Every time you finish a feature, you know, as a developer, you're basically sitting with a lawyer going through which you built and saying, is there a patent here? And you

get bonuses based on how many little cubes you get for getting patents? Right, Yeah, can you not open source patented code only if you release the patents, you're basically junking the patents forgetting about the patents. Wow? Yeah, And so to open source entity framework. They unwound those in a variety of ways. And should I ever finish this book and not actually die first all the things they did is kind of madness, but it was profoundly to

me. It was profoundly important. But not so much again, not that they did it, but that the affected had on the rest of the company. Yeah, because the rest of the company was then suddenly you were allowed to consider the idea of taking existing code and open source again, or that it never think it's ever been done. I think about Scott Guthrie, who championed the open source stuff in the cloud, and all of the patents in his office. You've seen them, right, I mean they're hanging on the

walls, they're in trophies and stuff. He's got like one hundred patents or something or more, well more, but plenty of azure Stool still closed source, right, There's only certain things that are. I think we can assume that quite big parts of a still close source. Yea very much. Yeah, but but yeah, and the real answer to open sourcing dot Net was to rewrite dot net. Yeah yeah, yeah, So the patterns may apply

to the old codebase, but they which is still closed source. But but they actually is like from IF from IF's Classic five, which was completely close source, and then they actually managed to build that when they initiated in a complex for for a version six and actually got at least one I think there was. There was. There was more contributors than me. Not many,

but there was. So the fact that they took contributors through Coplex to me is fascinating because it shows Yeah, it pointed to the way forward and the fact that they ultimately moved away from coplex and onto GitHub that was far better

suited to that problem. Absolutely, absolutely, and of course they realized that when they started not need to call that that was an appropriate platform for doing things like signal R I think was the first, although it was it was started as a GitHub project and then became part of Microsoft later, but it certainly was a demonstration of contribution. Yeah, well, should we get back to any framework? Sorry? Sorry, I could listen to your stories all

day and I can't wait to read your book. Yeah, it's only someone who write it'd be awesome. Let's ask the classic question for all anity framework people, which is code first or database first? Yes, I'm I'm a big fan of a database or let's this is call it database. Just call

it schemer first. Maybe, yes, I think that's a better name, because it's like, if you do the pitfall of doing model first is that unless you think schemer, think about the data type and the sizes and the appropriate data type for each of your properties, um, you end up doing something wrong. Like the classic one is, of course, the fact that if you define something to be a string, it will end up as a barcha max property in field in the database, which I don't know, maybe

you don't know what this, which nobody actually wants. Nobody really wants a string two gigabyte string for storing that those one hunter. Yeah, if you do want a too big abyte string, stop that. You don't do that. That's story is a blob everything. You shouldn't do that anyway, not

in not in the poor database. So yeah something. Yeah, And I love the way you're describing this error because what you end up doing with code first then is being very clever about thinking about how you're going to make your schemes. And if you're going to think that way, just make the schemas.

Yeah, it's more discribed exactly, because then you start. Then you basically have to take a ate your model with a tiny fragments of something that looks basically like sequel, like in attributes or like small hint thing this isn't I don't want this. I want to store this as a string, but I don't want any foreign characters in it, so I want it to be non Unicode, so I have to use is unicode falls and I want it

to be only two hundred and fifty characters. I want my dates to be as small as possible, so I want them to be with less precision and so on. You know, it's an easy way to do that. It's with create table. It's a very easy way to do that, exactly clear.

And the cool thing about it is that's actually in particular in the sequel server area, which is my kind of area of expertise here, is that's really really good tooling for doing that inside and outside of Visual Studio, in visual studio and as your data studio Sigle management studio even yeah, I still use that in single management studio even but in particular I'm really fond of of doing it inside visual studio in what is called a database project, because you

get like not only intelligence like you can't write bad create table statements that don't build or compile or whatever you call it in the in the secul world, or cannot execute anyway. But you also get like a cohesive understanding of your

entire schemer um as part of that tooling. So if you're writing a view and you're referencing some other column and table from that view, you will not be able to write something pointing to a column that doesn't exist, because it knows your entire schemer and can see that as a model and provide intelligence and

of course the built if you If you so, we will fail. If if you are inconsistent and referring to things that don't exist, right, you're you're stirring up memories for me, Matt None road trip the what was the nickname that for those data projects, There was a nickname for that technology individual studio, that guy. We're old da data data data dude. That's it, data dude. Yeah, you got it. You pulled it out, nice one. That's right. That's all right. And this was the beginning

of treating that schema as source code. Yeah right, you no longer, did you know? You no longer? Because you can't just drop a database and recreated the data. And it's important. And so the fact that data Dude would would take your modified schema, analyze your existing database, and write the altar statements for you. Yeah, you weren't storing the alter statements a schema. You were storing a new schema as schema. But the tool would

would fix the two together. Like yeah, that's a that was a metic juice, hugely power. Yes. So so I call it the Sciat State database M because you actually you're describing at this point in time, I'm in order to accommodate this new feature or whatever, I need these two additional tables, and I need an extra column, and I need a foreign key here and there and so on, and this this is part of my my new feature. And so so I want to describe after I implemented my new feature,

this is what I want the resulting schema to look like. Nice. Yeah, So so this desired state, that's what I would call it here. Yeah, No, And it's very compelling. And it's one of the arguments for code first is that it's just part of your you keep it all part of your source code. But it's like, hey, you know better ways let's sea the schema part of the source code too, because it is declarative and coherent, and you know, more people can work on it with

you, and it creates great results for Entity framework. So yeah, well I'm glad we're in violent agreement, Eric, thank you for that. I don't know where we were gonna get. What is no no, no, no no? What is dak fx and so so? Dak fx is actually an API that Microsoft publishes as a Nougat package dot Net API, which allows you to manipulate the result of a database product. The output of a database product is something called a duck pack, which is basically a SIP file with

some examil files inside it describing the schema. So this is what the tooling reads when it's applying the changes. It reads this duck pack and compares it with the running production database. That's dot d c P A C by the way, E A c P. Yes. That framework allows you to create duck packs programmatically and manipulate them and deploy them and so on from your from your own code. So that is essentially taking the taking a place of a

create scripts like script creation tool exactly exactly. So it's it's taking the place of a like migration script or so one is you can run this from your own code and do whatever you want. And that's also a command line tool which of course is just a thin layer over this API called Sequel package, which is a dot Net global tool you can install these days. Wow, very cool, and that will actually do like the publishing of of your changes

and I have made tooling. The more part of the EF core power Tools features set is that it can actually read the schemer from a duck pack and generate the database model from that instead of from a running database. Nice.

Wow, So you have you have a like a sometimes here the term in a developer loop or whatever that where you where you can actually create something with your create table statements and then just quickly run this tooling and then it will update your c shop model and the c shop entities based on the team to set you just made with your Sequel statements. Yeah. I like that fair

cool. And the more we can treat a database like it's just other code part part of the overall package and goes with with versions and so forth. Yea. And most importantly with that, it's sort of desired state mindset can be rolled back I mean not recommended nobody, but it is possible. The main thing that everyone's terrified around database is getting that deadlock state where it's like the old code won't run and the new code doesn't work, Like what do

we do? Yeah, yeah, guys, let's take a quick break, and when we come back, I'm gonna ask my question about my old pain. So stick around. We'll be right back, and we're back. You're listening to dot ned Rocks. I'm car Off Frankle, That's Richard Campbell, and that's Eric Eiskal Jansen. Uh, and we're talking data. We're talking

Anny framework and so here you go. Eric. When you're using any frameworking creating a context that you're going to use on a web back end, like say from an EPI controller, do you use tracking or do you turn it off? It depends. So there is a use case for tracking, yeah, on a web back end, because I always found it to be to get in the way. So what is that use? Use it for update statements. But now there's this new fangled execute update EPI, so the use

of it is populist. Let's just step back, man. Yeah, yeah, maybe a listeners can understand what why you are asking this question. So one of the major major features of IF core is also apart from the ability to generate sequel statement based on your careers, is the ability to track changes

to the to the entities that you hydrate from the database. And it's using something called a change tracker, which keeps a copy of everything you read and then compare so when you're doing updates, it compares the properties see what has changed. So it's only doing updates of things that have actually changed, so

it's not like doing a blindfold update of everything. And of course as an overhead of running that, like you're you're doing copies of data and you have to when you do saves, you have to do the comparison and to find out what needs to be updated and so on. So so in in in the ape and it's it's always on. You can switch it on, is like switch it off for your entire context in your configuration. But but if

you don't do that, it's always on. So so you you end up having a lot of s note tracking statements in your code to turn it off or for careers that some simply gets stuff. Yeah, I fun, I can't remember the issue thought I was having but I think it was when I went to go delete something. If some entity was out there that it was tracking and I deleted it, it would complain it wouldn't let me delete things, little things like that, and it's like, Hey, I'm the only

programmer here, right, why are you giving me this trouble? Why are you hurting me? Yeah? Yeah, So I always turned it off, and now that will. Of course seven they've actively made two new APIs, one called execute delete and one called execute update okay, which is like you can it's basically sugarcoating over a link way of phrasing a bulk update or bulk delete statement okay, and and by and by bulk it can I mean it

can also just hit one road, doesn't have to hit many rows. But so and and of course then you kind of all this about change tracking forget about it because you you basically just phrasing a strongly typed update statement or a strongly type delete statement and it's not tracking anything. I guess. I guess what's the benefit of tracking when you're only making calls into any framework database from you know, an API controller and you know your your data manager is a

singleton, and like, what's that what's the point of tracking. Before, when you had to do a delete or an update on an on an existing entity, you actually had to retrieve it first and then do your your remove method or your update your properties. So then you you actually had to have

tracking enabled because otherwise ef CORPS wouldn't know about those. So if you were changing like you have a record and you're changing a state column for example, in a in a put method, then you would have to get the entity and change track it and say I want to update the state from whatever completed or something like that, and then do a safe change is That was that was the only way you could do that if you didn't, if you weren't

really keen on right on calling a stop proceedure of writing work. But now with these two new APIs, you don't need to do that. If you don't, if you just know the ID of the of the road to delete, for exam, you would just put from formulate a link statement where the ID equal the idea that you just got in from the controller. Yeah. Now you're making me think that I wrote my stuff wrong because it worked and uh and I had change tracking turned off. We can do a code review

later. Yeah, yeah, I would love to. That'd be great. You know, I admit that I'm not an entity framework expert, but I remember people often end up with doing things like attached and update methods, and it's like things you should really use so hard, no exactly, yeah, so yeah, but but certainly the U the use of the change tracker as a and and and tracking changes is really really useful when you have a desktop

app, yeah, a state state full app. Yeah, and you have a long lived TB context, yes, and that is barely the case in a in a web api s otherwise you're doing it wrong. Anyway. Any framework was designed during the age of wind forms and WPF, wasn't it. Yeah, yeah, exactly, So it's like wind forms WPF, those kinds of like yeah, like disk top apps, enterprise desktop apps, and they had made a lot of sense to I will collect and a number of changes

on this form and then I will do a safe change. But unfortunately safe changes. Remember when we call them smart clients, Yeah, something like that, why they were dumb clients. Well, and eventually into framework six would then issue forty insert statements one by one, yeah, and you would sit

there exactly. So yeah, it's improved since then. Yeah, yeah, and we and we write software differently, let's face it, right, like that's it's interesting to think about trying to work any more dateless way, that kind of normal scalable approach to software. But do you say, you know it's it's stay. We're talking STAATEF only for data, right. I mean, if you think about a Blazer application, right, a Blazer server application, there's state for every user, but it's not. You don't have long

held dB contacts for every user. That's crazy because you know if you have it's fine when you have one client, right and you have a few long running dB contacts, and that's all great when you're on a desktop app. But in a web app you millief blights, you're not going to have it. It doesn't really escape. No, No, as the number of users rises above one one, you're in trouble. Yeah, yeah, you're in

trouble. Yeah. So so the team actually makes a lot of improvements in in that area also for us like swoot Putter and scalability, because they wanted to to do better in a in a suite called take empower right where they're

measuring against other frameworks and competitors so to speak. We and we've talked about this with Scott Hunter a number of times, that the dot net team as a whole was big on let's get good scores on tech em power and the combination of like razor pages on dot Net, raizor pages on the linking. It's like all those different kinds of setups, and you don't want to be the one left out, no, exactly, you don't want it to not

be any framework exactly, And I mean you can call that. It's also it's turned out maybe there were tweaking stuff for just for the purpose or making things, making very unusual choices about how they implemented stuff for the purpose of performance pure performance. Y. I'm looking at the number one dot net stack bar chart right now tech empower. Coming in ninth is asp core on Linux

with postgress raw data database connectivity writing directly the database. Ye. I don't know that you do that right, but exact could be it's a structure to get good performance exactly. But but I think you no matter why they did, there's certainly the any user of ef core has benefited tremendously sure from from that, from that optimization, and that the effort that was engineering effort that was put into it. Yeah, there is an entity Framework one and it's

thirty eighth and again still incredibly fast. Right like that. There's a huge difference between the thirty eighth position and the first position is a small number. But it's ASP dot net core running on Linux with Postgress as a database, with entity framework. That's not that's a very reasonable stack. It is not unusual in any way to look at it. And and because you're talking, they call it full o RM. So it's like, could be pointed at

sequel, could be pointed at my sequel. You know, it doesn't matter. I mean, performance is going to vary obviously, but just the fact that you can point at it to say it's in there, it's in the top hundred, yeah, you know. And it's so it runs in these extraordinarily high performance numbers. Admittedly for an artificial task, yeah, constructive test is but yeah, but nonetheless, so, yeah, it's good to have them there. Every every Entity framework Core provider, of course, needs an

eighty O dot Net provider underneath it. That's that's just that's reality. How Microsoft, Yah, that's a reality, and that's how Microsoft decided to build it because otherwise it would never get anywhere. So they're using existing groundwork of all the ad dot net providers that are out there, and on top of

that, you can build a provider for your database system. Right. And probably all know that the provider for a sequel server was System Data sequel Client, right, Yeah, and in dot neet framework, and it was actually also parts of it reported to dotnet core very early in the dot neet core time frame. But now Microsoft has actually open sourced all that and they have created as as stand alone repository for the Microsoft client driver of a sequel server

and as your sequel and it's called Microsoft Data Sequel Client, right. And also I actually also contribute to that project. Nice, but so so that's also a very interesting development. The problem with that project is that it's it's it's like a two headed beast. It's a it has a dot net corep dot dot net brands, it has dot Net versions of all the classes, and it has dot neet Framework versions of multiple classes, and they're trying to

merge those two. But it's basically like a two headed beast, and it's the dot net framework codebase of course, is like, yes, you can see Scott got three is a signature in there somewhere or whatever. It's like two thousand and something one or whatever or before that. Even of course the dot net core codebase is newer, but just because dot neet core is newer.

But then it's also a little bit quirky because they had to not create, not add a lot of features for the first iterations of that dot neet core because it just just just didn't have each a parody with dot net framework at that point. And now they're trying to move them back. So so

it's it's it's really part of the performance. Of course, also hintes on the performance of that driver, right, and it's it's a quirky code base, and I contribute to it myself, and the team is really good, and they're making a big effort, but I mean, it is what it is, and they can't they can't just rip it away and start over.

So so what is happening now, which I think is extremely interesting, is that the of Court team, i assume, in collaboration with some people from the sequel team, is actually creating a new provider completely from scratch, using all the new fangled low memory APIs like spans and so your educational APIs for reading stuff directly from the wire and so on. Well, so it'll I imagine it'll surface as a lightweight provider with a limited set of functionality. It

will surface as a definitely surface as a lightweight provider. And I don't think the intention is to ever support all the sequel ball copies, sequel dependency. You have all these kind of classes that have emerged one by one in the classic sequal client, and that will not be part of it. Sure, but no, but that it's no different than parts of the original dot and framework never made it decre because they were too dependent on isacic filters or Windows

specific stuff, Windows registry stuff like that. So yeah, but it came later in additional packages and things you could add on. But I could also imagine once this thing is shipped, you'll use it where you can and where you must use the original one. You will no reason not to use both. You've got a chunk of code depending on bulk copy, or use the old one if you don't care about performance, you're using bulk copy, yep. But for the lightweight you know, scaly nobody does massive millions of bulk

copy operations. They do a few it'll be the min client thing, yeah yeah, or maybe they will just do it from the command line or something like that. Yeah, not necessarily in something that's just running all the time, like that time when we moved all our data from our sequel server to Adgure. Remember that we were in New Zealand. Yeah, I remember that

and it went so well it did, yeah kind of. So, speaking of performance, I want to know your thoughts on Dapper, the open source RM and dapper contrive, which is another library that adds linked to Dapper. So Dapper is a lightweight wrapper around adeo dot net and this is Dapper, not dap R correct, right, And it's fast and people when it came out, we're saying it, you know, it's faster than and the framework.

And it was for a while, and then when the new Entity framework came out, people were telling me that the performance was on par with Dapper. I haven't tested, of course, but that's what they were saying. So what do you think about it? I think it really served a purpose at one point in time where there was people suffering from performance issues with the in particularly with entitive framework. But I mean also the initial iterations of you,

of course certainly had room for improvement. Yeah, that is no longer the case. That's been we talked about with taking power effort that has been taking place. There's been a lot of work done in that area, and the queerer performance is definitely on par with Dappa and therefore eighty on that.

Yeah. Yes, Dappa has the ability to serialize any class you have in your code, so populate any class you have in a code from a secret query and that has not been a feature of ef core until if Core eight, which is coming later this year, So you can take any class you have in your code and serialize it. I don't think it supports things advanced things like multiple results sets like Dabba does, and that's probably not coming. So if you have a need for that, like consume multiple sub results,

it's from a start procedure or something. Yeah, then Dabba certainly still has a place. I'm speaking for myself, but I really like that I don't have to have too many dependencies that does something that's almost the same thing. Yeah. Right. Also, you're kind of locked in a sequel serve with Dapper because it's really for sequel, isn't it or does it work with any ad on that. I think it's supports, No, it's supports in it.

Basically it supports a number of adio providers. Okay, that makes sense because it's yeah, no, it's just it's just a rapper over a deep connection. Acted. Yeah, so it supports any a lot of adio dot net providers, got it. Yeah, but still, yeah, it's nice to know that. I think it gives me great confidence to know that the stack I'm using can do everything I want to do, right from from raw sequel mapping stock procedures, mapping random classes in my code to advanced link queries.

And I appreciate the idea that they've optimized enough of EF that they're now looking at the providers because that's where the winds are going to come exactly, exactly. Yeah, I think that's a really interesting development that now they can't really do more because of just how dot networks. You can't you can only do so much. Oh yeah, Stephen's hub has done all the things exactly the optimization options are diminishing, and written two hundred pages blog posts about it.

So yes, it's amazing. Yeah, yeah, if I just you know, it's one of those blogboards like I just trust you using new code. Will you not make me read this? Please? It's a complic The only thing worse it is that long? Is it so complex? Yeah? Yeah? Yeah? If you ever wanted proof that optimized code is more difficult to read, right, there's a reason why we use these abstractions like entity framework and so forth to make data acts as simpler. Yeah, raw calls

would be faster, but would you read that code? Right? You don't want to look at optimized code. It makes you sad? Yeah, you just want to use it, yeah, exactly, just wanted benefit from it. I switched up to dot net seven and my stuff was faster. So speaking of dot at seven, let's say we got some old F six running on dot framework. We want to move it into dot net seven or even dot net eight or even done at six. I mean, what is involved in doing that? Is it? Is it as going to be as painful

as I think? Actually? At one at one point, the ef EF team created a Dotnet standard two point one version of the EF six Classic, which means that you can actually run IF six on dot neet core or dot neet six or seven or eight. Yes, m that codebase that provider is of course Sequel server only, and it also still uses the legacy System Data

Sequel Client. Okay, so it doesn't get all like if there's a new version of Sequel server that requires some client team is they would not be incorporated because that that piece of software is only maintained for top security issues and nothing else. So it's it's basically like in maintenance mode. Could you use it as a step in stone, where would you go from there? I published I have six provider which bridges the gap, so you can take advantage of

this new Microsoft Data Sequence client driver we just spoke about. And it's of course supports all the always encrypted technology that's come recently with the Sequel server. It supports all the authentication methods, the new authentication methods against as your sequel like manage Identity, which allows you to create passwordless connections from your app service, for example, to an assequel database similar to what you were used to

on premises with the integrated security and so on. And that is not that's not very good supported in System Data Sequel Client, but of course it's fully supported in Microsoft Data Sequence. So I probably an alternative provider that bites a

gap. And I was actually recently just fortunate enough to have a pull request accepted for Entity Framework six that will that will publish what I did as a as a supported Microsoft provider for that useless Microsoft Data secut client instead of a system data secret, so you get all the benefit of yea like sequel. Server two thousand and twenty two also introduced a new over the wire protocol that works better with firewalls called t D said, you can google it and read

about it. But in order to get that support, so it's more better encryption of what happens over the wire, even login process is encrypted. It wasn't before. So and in order to you get that you need you didn't need the latest client driver. And my package which is currently published and supported but only by me, not by my UM is a certainly a stepping stone

that can help you there. That's very course. So you've got all these extensions and open source tools and products, um, we'll add links to them, of course. But what about somebody who was writing extensions and wants to get individual studio You have any advice for them? Yes, mass christ follow follow mass christis and he's a program manager on the Visual Student team and he has a regular on the show. Yes, and he has published a lot

of content about extensibility. Um like he had some like workshops where he like took you through creating an extension completely from scratch insous studio with serving various purposes, and a lot of what he did in his basement there was actually ended up being published extensions. So if you if you prefer to do like viewing stuff on YouTube or similar media, then that's definitely a little way to go.

And he's really really good at explaining stuff. Yeah, and there is a library that can also help you because it is a little bit of it

can quickly become a little bit of a black back art. But the mass Cusson, together with some other clever guys at Microsoft, has created a tool called the Visics Community tool Kit, which is a library that makes it easy to do things that you would normally do as an extension writer and not having to find out this is this interface and you have to convert it to this implementation and then call this and that method and put the h ref and get

a zero non zero quote back from this co operate them. So when all that's is wrapped nicely for you in this library, So doing things like showing messages in a business studio, addressing the status BA and putting up like yellow bars and things like that that you want to do from your extension becomes like basically a one liner using that That library nice. So that's definitely my recommendation

is to the best way to get started with that. Well, this is all Danish mafia stuff, right, Yeah, And what I appreciate about Mads Christensen is he walks the walk like that. Dude's got a lot of extensions, Like there's a reason why he can explain it so well, he does the work. He does it. Yeah, I mean, it's just it must be huge effort for him just to keep all his extensions current. Oh yeah, that's great. Yeah. Well and his ad file extension essentially that

made it individual studio. Many many of his extension has gradually paved their way into a visual studio one by one. So it's it's very cool, very cool. Yeah. So what's next for you, my friend? What are you working on? I'm so the ef Core power Tools, which has about three hundred thousand installs currently in visual studio, and that of course is yeah, it wakes me very proud, but it's it's still Windows only. You need Visual Studio on Windows in order to use it. Recently, I actually

somebody said, oh can this run on Arm? It could now that visou Studio runs on Arm, so yeah, yes, but it's still limited to Windows of course. Yeah. So the next thing I'm working on is is actually taking that. Um. So, as I said earlier, I'm basing my two ruling on the scaffolding EPI if you wish that that if Core provides. But I'm adding a lot of additional features, and all those additional features I would like to make them available to other users on other platforms. So

I'm next. For me, it's basically thinking about creating a command line version of ef core power Tools. Yeah. Um and of course I mean some people ask me, can I is a googie for this in Visual Studio code. Well, at least I give the groundwork for somebody to so maybe I don't know anything about the other script or so I couldn't even I wouldn't know

where to start. We will not, but somebody else can then wrap my command line tool in some some nice configuration googie to show my my configuration file in there. So so it will be a big, big stepping stone for me, and then I'm also quite exciting for me because I've never really if something ran on other platforms that I created, it was by accident, it was not intentional, so so I'm really looking forward to that. Yeah,

that's great. Well, Eric Jansen's finn to like to have you on the show and thank you for all your hard work in great to dissemination of this complex topic. It's it's great, great to talking to you. Thanks for having me, all right, and we'll talk to you next time on dot

net rocks. Dot net Rocks is brought to you by Franklin's Net and produced by Pops Studios, a full service audio, video and post production facility located physically in New London, Connecticut, and of course in the cloud online at pwop dot com. Visit our website at dt n et r ocks dot com for RSS feeds, downloads, mobile apps, comments, and access to the full archives going back to show number one, recorded in September two thousand and

two. And make sure you check out our sponsors. They keep us in business. Now go write some code CNX time Goman

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android