In development and while testing various things in EF6 core – I tend to end up with a lot of migration garbage which occasionally I have to take out. This is how it’s done #notetoself
Delete all *. cs files in the Migrations Folder.
Delete the _MigrationHistory Table in the Database
Delete all database tables subject to the migration (take care of the data 🙂 ).
Run dotnet ef migrations add Reset
Run dotnet ef migrations list to get the full name of last migration
#notetoself … Once again, scratching my head for way to long about something that turns out to have a simple workaround #devlife
On one of my (new) blazor pages (/Bookings/TeeTimes), onclick event was not firing. Didn’t matter what kind of flavour of onclick declaration I used, the event was not getting fired.
Until of course I noticed that this page was producing a lot of blazor loading errors:
Turns out I was running the project (as usual) from command line (dotnet) and had a shortcut in my browser to go directly to this page. Seems like that sets the “document root” to “Bookings” and from that it tries to find the blazor files.
Starting from the root page and navigating to the Bookings/TeeTimes page solved the problem, with the permanent fix being adding this within the head element of the layout
Við erum live c.a. þriðja hvern þriðjudag (þri-þri – auðvelt að muna) en hina 1-2 þriðjudagana á milli munum við hita upp með einhverju skemmtilegu myndskeiði sem leiðir okkur að efnisatriði næsta fundar. Sjáumst “live” eftir 2 vikur.
EF6 Core – reconfiguring navigation properties, the runtime was complaining about a column GolferId being missing (invalid database column).
Took me a minute to figure out and remember the default foreign key dependency naming convention in EF. Sometimes these frameworks are a bit too intelligent for my taste.
Turns out the EF was guessing that if I have a navigation property to a related entity called “User” – the framework will automatically use an object property field called “UserId” … easily solved with the ForeignKey tag 🙂
Continuing my framework move from .net framework 4.8 to .net 5 (Preview7) I obviously have to take the step moving from a framework Entity Framework to EntityFrameworkCore. A few notes to self regarding the upgrade.
The old context generation doesn’t make sense any more. EF core understandably doesn’t have the design options 4.8 (EF 6.2) had, so what made sense for me was to regenerate the model from database using
This simply worked out of the box, with a new code representation of my database generated in the defined target folder.
As I am dealing with substantial number of tables, some with non-orthodox naming conventions (plural entity names – which I will fix), the generated code varied slightly from my pre-existing entity structure, breaking a lot of code.
Now it is just a matter of cleaning up a bit in the database, creating a clear migration path from the production database to the target setup for GolfCloudPro.com …. easy right!? :Þ
I had a problem with Xamarin.Forms MessagingCenter – as sometimes the messages disappeared. Code that on most occasions worked nicely failed silently and from debug output – the messages never reached the subscription methods. What I eventually found out was happening (after days of frustration) was that one of the subscriptions was updating the UI and since this is on a thread other than the main one – it just failed silently and the next message subscription never got the message. This is not a 100% diagnostic (I don’t care to waste more time on this) but moving the UI updates explicitly to the main thread solved the issue. Hope this helps someone … a day or two of pointless debugging 🙂