Click here to Skip to main content
15,888,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey y'all,

Here's what I have:
So I have a highly normalized database. There is a table called BaseTypes which stores a very short list of "text","numeric","Date" & "bitwise". These are used to categorize .Net System types so we can apply general operations.

I have another table called BaseSelectorOperation which includes all of the selector operations you can perform on any base type, such as: "equals", "Greater Than", "Contains" etc.

I have a third link table that matches the BaseTypes with the BaseSelectorOperations. This gives us the link between "number" and "equals", "greater than", "less than" and their negations, and also a link between "text" and "equals", "contains", "starts with", etc.


Here's what I want:
SelectorTypes always have a BaseSelectorType (BaseTypes is really only another link table - sort of) So I thought I might be able to treat the BaseSelectorType / SelectorTypes as a single entity using the LinqToSql Association Inheritance? I just can't get it to work.

I know I could use a view, but I wanted to explore the feature because I have no understanding of what those association properties actually do.

Anyway: this is obviously non-urgent. Any advice would be helpful.

Thanks everyone ^_^

Have a good Easter break if it applies to you ^_^

Andy

What I have tried:

The setting I mentioned include Parent / Child inheritance properties. I have tried setting the parent to "virtual" and the child to "override" but I get the error:
Error	19	'DataAccess.EntityFramework.RateUploader.BaseSelectorOperation.SelectorOperations': no suitable method found to override	[Path]\Context.designer.cs	4089	48	DataAccess (Integration\DataAccess)


i also tried setting Child to new with parent as (none), but it doesn't seem to add anything to the child.
Posted
Comments
Sascha Lefèvre 24-Mar-16 13:37pm    
I'm curious: Why do you do this in the database?
Andy Lanng 29-Mar-16 4:37am    
There are several managers who like a more direct approach to data. This way they can't mess up what's there (and I know they'll try).
It's just a handicap I have to live with :S
Sascha Lefèvre 29-Mar-16 12:23pm    
I'm doing something very similar, if not the same, but in code. Wouldn't that work for you as well? In code it's completely safe from being messed up :)
Andy Lanng 30-Mar-16 4:33am    
My manager (there's only one I worry about) doesn't get involved in code. It's WAY over his head. So is SQL in many cases but it's very hard to keep him away from it. I have also reflected the readonly tables in enums and my data projections will use nothing but the enum. This way I can ensure that this manager doesn't break anything here. I actually compile queries based on these tables so any data integrity issue would really screw the pooch.

Like I say, I'm going to make some of the table read-only so I can just use views for my database. I was just curious if I could use inheritance instead. I'm pretty convinced that I can't >_<

My query syntax was originally stored in XML format, but the manager squeezed in a "transparency" requirement. I don't mind so much. I have even added the integrity requirement to the story in such a way that it mock the "transparency" requirement, but the management don't understand the technical jargon ^_^

It's just my little way of venting ^_^
Sascha Lefèvre 30-Mar-16 5:30am    
Hehe :)

Alright - to get back to your question, I'm a bit confused why you mention both EF and LinqToSql?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900