Overclock.net - An Overclocking Community - View Single Post - Relational Database setup question

View Single Post
post #2 of (permalink) Old 03-14-2019, 05:12 AM
BFRD
Some call me... Bifford
 
BFRD's Avatar
 
Join Date: Dec 2004
Location: Carrollton, TX
Posts: 5,264
Database normalization is obviously a complex topic and can be highly contested depending on to whom you are speaking. I like a common sense approach, normalize until it makes sense. So far from what you put down, you are on the right track. The properties do pose a challenge. What I would do is to figure out your property sets for each item and select the common properties. That list may not be large, but some properties will be common. I would be pretty generous here things like MAC addresses could be considered common. Looking at the Spiceworks app may give you some insight into the things they thought should be common. I would create non-null columns for each of these common properties. For the rest, consider using a single nvarchar(max) column. I am assuming MS SQL Server since you are using an MS dev stack. In this column, you can serialize an object containing all of the custom properties. I would probably go with a JSON serialization even for a desktop app. Newtonsoft is built into the framework and makes serialization and deserialization of objects incredibly simple. It does make querying against the custom values more difficult, but not impossible. I am not sure how often that would really be necessary anyway.

And now for some unsolicited advice...
Please use C# instead of VB.NET. I cannot think of a good reason to use VB.NET over C#. Learning the syntax is not difficult and will give you a better understanding of all c-based languages.



BFRD is offline