Click here to Skip to main content
15,887,240 members
Home / Discussions / C#
   

C#

 
AnswerRe: PetaPoco (T4 Template) in .Net Core 2.0 for MSql : - SerializationException in generating Database.cs Pin
BillWoodruff4-Jan-18 21:37
professionalBillWoodruff4-Jan-18 21:37 
PraiseRe: PetaPoco (T4 Template) in .Net Core 2.0 for MSql : - SerializationException in generating Database.cs Pin
J Kaur11-Jan-18 10:52
J Kaur11-Jan-18 10:52 
AnswerRe: PetaPoco (T4 Template) in .Net Core 2.0 for MSql : - SerializationException in generating Database.cs Pin
Vincent Maverick Durano5-Jan-18 1:59
professionalVincent Maverick Durano5-Jan-18 1:59 
PraiseRe: PetaPoco (T4 Template) in .Net Core 2.0 for MSql : - SerializationException in generating Database.cs Pin
J Kaur11-Jan-18 10:51
J Kaur11-Jan-18 10:51 
QuestionAdding Items in a Class Pin
Member 136074754-Jan-18 12:04
Member 136074754-Jan-18 12:04 
AnswerRe: Adding Items in a Class Pin
Mycroft Holmes4-Jan-18 12:41
professionalMycroft Holmes4-Jan-18 12:41 
AnswerRe: Adding Items in a Class Pin
BillWoodruff4-Jan-18 21:27
professionalBillWoodruff4-Jan-18 21:27 
AnswerRe: Adding Items in a Class Pin
OriginalGriff4-Jan-18 21:39
mveOriginalGriff4-Jan-18 21:39 
Ignore this specific example, and think more generally: how would you do this in the "real world"?
What information is there that is "single use" and associated with one individual? What information is shared by multiple individuals? And what information is multiply associated with a single individual?

Think about cars for a moment.
"Your car" is a specific vehicle: it has a unique registration, VIN number. But it shares it's manufacturer with many other vehicles, it's model with a large number of those, it's colour with a range of vehicles from other manufacturers, and it has a number of optional features associated with that specific vehicle.

So you have "single use" info: registration, VIN, owner.
"shared" info: manufacturer, model, colour.
"multiple" info: reversing camera, GPS system, leather interior.

So a Car class would need to have a way to contain that:
public class Car
    {
    public string Registration { get; set; }
    public string VIN { get; set; }
    public Manufacturer Manufacturer { get; set; }
    public Model Model { get; set; }
    public Color Color { get; set; }
    public List<Option> Options { get; set; }
    }
Your problem is the same thing: analyze the data you need to handle, and work out how you need to store it. With a bit of thinking, it should be pretty obvious what you need to do - so try it with several examples, and refine your model until it works with everything you can think of.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

Questionlistview to combobox - HELP Pin
Member 136074164-Jan-18 10:31
Member 136074164-Jan-18 10:31 
QuestionRe: listview to combobox - HELP Pin
Gerry Schmitz4-Jan-18 10:40
mveGerry Schmitz4-Jan-18 10:40 
AnswerRe: listview to combobox - HELP Pin
Member 136074165-Jan-18 12:32
Member 136074165-Jan-18 12:32 
GeneralRe: listview to combobox - HELP Pin
Gerry Schmitz6-Jan-18 6:28
mveGerry Schmitz6-Jan-18 6:28 
GeneralRe: listview to combobox - HELP Pin
Member 136074167-Jan-18 3:59
Member 136074167-Jan-18 3:59 
GeneralRe: listview to combobox - HELP Pin
Gerry Schmitz7-Jan-18 7:10
mveGerry Schmitz7-Jan-18 7:10 
AnswerRe: listview to combobox - HELP Pin
Mycroft Holmes4-Jan-18 12:44
professionalMycroft Holmes4-Jan-18 12:44 
GeneralRe: listview to combobox - HELP Pin
Member 136074165-Jan-18 12:26
Member 136074165-Jan-18 12:26 
GeneralRe: listview to combobox - HELP Pin
Mycroft Holmes6-Jan-18 10:27
professionalMycroft Holmes6-Jan-18 10:27 
Questionimprove a recursive search method ? Pin
BillWoodruff4-Jan-18 5:01
professionalBillWoodruff4-Jan-18 5:01 
AnswerRe: improve a recursive search method ? Pin
Gerry Schmitz4-Jan-18 10:02
mveGerry Schmitz4-Jan-18 10:02 
GeneralRe: improve a recursive search method ? Pin
BillWoodruff4-Jan-18 12:24
professionalBillWoodruff4-Jan-18 12:24 
GeneralMessage Closed Pin
4-Jan-18 13:05
mveGerry Schmitz4-Jan-18 13:05 
GeneralMessage Closed Pin
4-Jan-18 20:10
professionalBillWoodruff4-Jan-18 20:10 
GeneralRe: improve a recursive search method ? Pin
Gerry Schmitz4-Jan-18 20:27
mveGerry Schmitz4-Jan-18 20:27 
AnswerRe: improve a recursive search method ? Pin
Richard Deeming8-Jan-18 5:55
mveRichard Deeming8-Jan-18 5:55 
GeneralRe: improve a recursive search method ? Pin
BillWoodruff15-Jan-18 6:01
professionalBillWoodruff15-Jan-18 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.