That's one table referenced 3 times in another table hence the Entity Framework created 3 different objects - its not a problem on Normalization - I am asking about Entity Framework solution for it - any help my friend. I am using Entity Framework Database first approach.
But its Database First - when I refresh the Entities automatically wouldn't it remove the settings that I put in my Entity classes? Just checking - thank you - how to handle if its Database first approach - thank you
I am getting the following error when I am write the following Linq - can somebody please suggest me to write the same without getting the error.
My Linq is as follows:
from v in allViolations
from r in allInspectionResults
from i in allItems
r.InspectionResultId == i.InspectionResultId &&
i.InspectionItemId == v.InspectionItemId
ViolationId = v.ViolationId,
ViolationNumber = v.ViolationNumber,
ViolationDate = v.ViolationDate,
ViolationType = v.ViolationType.ViolationTypeCode,
ItemYear = i.ItemYear,
ItemMakeManufacturer = i.ItemMakeManufacturer,
ItemModel = i.ItemModel,
VIN = i.VIN,
PIN = i.PIN,
InspectionResultId = r.InspectionResultId,
InspectionResultNumber = r.InspectionRequestNumber,
DealerDmvNumber = r.DealerDmvNumber,
InspectedCompanyName = (from a in contacts where a.ContactId == r.InspectedCompanyDataId select a.FirstName)?.FirstOrDefault()
At the line "InspectedCompanyName = (from a in contacts where a.ContactId == r.InspectedCompanyDataId select a.FirstName)?.FirstOrDefault()"
I am getting following error - how can I get rid of it - thank you
An expression tree lambda may not contain a null propagating operator
Hi I am trying to alter a column to fit max length - I changed the entity property and ran Add migration - it did well in the first then in committing it on Git or over written by the remote branch or something its last when I was merging it in master branch then onwards it started giving me issues - my property that I changed is as follows:
I tried in the following ways to workaround for it
Even though I made it EventComment 1000 in Database then deleted my migration file - then ran the add migration now the file is created in the above way - not able to do anything - now its not let me login to the application as the database is failing - any help please - later its failing if I make the EventComment length max in Database and ran the application - still its failing validation errors. Any help please - just get away from validating any more from Code First, its painful to care things this much. Any help please.
When I make the Database field as Max and Entity property also as 7999 - still it is giving me the following exception in the application - just not able to decide
The field EventComment must be a string with a maximum length of 1000.
I am getting the following error while trying to run the add migration
The Designer Code forthis migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration.
If you make additional changes to your model that you want to include inthis migration, then you can re-scaffold it by running 'Add-Migration AlterColumnLemgthEventComment' again.
Even though I made it EventComment 1000 in Database then deleted my migration file - then ran the add migration
As explained in the article above, Add-Migration doesn't look at the database; it looks at the model snapshot stored with the last migration. Manually changing the database won't cause EF to generate a migration to change it back.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Can you please help me what can I do now - yes it seems that it is storing in snapshot - how can I clean it up - I am feeling very discomfort in changing things as it stored in snapshot and any mistake like the one above it happened because of merging - it made it very difficult - any help please. Can you please suggest me something please - thank you.
Hi Richard - how can I freshly generate add migration because its not creating me the same again. So I want to generate the migration file again how can I? The file is gone I am not looking for it - merging links help me but for future to be careful. Now I want to regenerate the migration files with the code what can I do? Its not allowing me. Please need help.
It was so simple in VB, accessing other forms properties.
The main form, right after it's drawn, I want to check for a .db file and if it dosen't exist, to make visible a form (already defined) to create it the db file. (form already as always-on-top, but not visible).
After a ton of internet research, i'm still where I started. Closest I got gave me a threading error, which I've learned to work around in VB, but this, is just confusing (TechTracker.CreateDB.ActiveForm.Visible = true;)
I like how much c# is to PHP AFA structure, loops, arrays, strings. But this stuff is confusing me
publicpartialclass Main : Form
privatevoid Main_Load(object sender, EventArgs e)
if(!File.Exists(Directory.GetCurrentDirectory() + "\\Tracker.db"))
//yeah none of these worked//((CreateDB)this.Owner).Show();//Form CreateDBForm = CreateDB.FindForm();//TechTracker.CreateDB.ActiveForm.Visible = true;//System.Windows.Forms.Control.Invoke;
publicpartialclass CreateDB : Form
both were made as windows forms designer. createDB is not visible by default. As you can see, if the file is not there, they choose to create it as an sqlLite (I know I still have to define it in using in createdb) database. createDB is topmost enabled and won't let the main form be accessible when it's up. That logic shouldn't be hard, i've done it with vb before. I'll later get a better method of detecting the database file (store filepath in registry, or local file). Probably even allow switching DB files in a settings dropdown. For now, this just basic code to get some of the basic functionality out of this way.
I learned VB.net from scratch using only google on trial and error. Got fairly good at it too. It's just these individual methods of c# I need to get out of the way
oh and yes, it's me from the previous post. I decided to go with sqllite instead of mysql or transactional HTTP transfer. I'm making this mainly for me for the time being, and I can just use google drive or something to sync the sqllite db file for housecall (on my laptop) or home use
That is actually a wrapper around exactly what I posted. What you're calling "in VB.NET" is actually just a bunch of classes in a namespace that wrap this kind of functionality to maintain "backward compatibility" with older VB code.
The wrappers and extensions are not in the language itself, but is in a library of classes. Since it's all in a .NET library, you could even use the library in other languages, like C#, but I wouldn't recommend doing that. What the library does is insulate you from learning and knowing all the gritty details of how things should be done and they actually work.