This question is locked. New answers and comments are not allowed.
Hi.
I have three PC classes using flat inheritance strategy (shared table):
public class Principal {
public string Name {get; set;}
}
public class BuiltinAccount : Principal {
public AccountType BuiltinType {get; set;}
}
public class BuiltinRole : Principal {
public RoleType BuiltinType {get; set;}
}
The two derived classes share the column "BuiltinType" for their properties "BuiltinAccount" and "BuiltinRole" which works fine, until I try to use stored procedures.
When building database, I get the following exception when creating stored procedure for the base class:
The variable name '@BuiltinType' has already been declared. Variable names must be unique within a query batch or stored procedure.
I guess this has to do with the fact that all columns in the table will be initialized either with a value or null, and since two derived classes reports the need of @BuiltinType column, they will be added twice.
Is this something you can fix, e.g. by performing a check if column already exists, and if so not add it again. It does work fine when not using stored procedures.
Best regards
Pål
I have three PC classes using flat inheritance strategy (shared table):
public class Principal {
public string Name {get; set;}
}
public class BuiltinAccount : Principal {
public AccountType BuiltinType {get; set;}
}
public class BuiltinRole : Principal {
public RoleType BuiltinType {get; set;}
}
The two derived classes share the column "BuiltinType" for their properties "BuiltinAccount" and "BuiltinRole" which works fine, until I try to use stored procedures.
When building database, I get the following exception when creating stored procedure for the base class:
The variable name '@BuiltinType' has already been declared. Variable names must be unique within a query batch or stored procedure.
I guess this has to do with the fact that all columns in the table will be initialized either with a value or null, and since two derived classes reports the need of @BuiltinType column, they will be added twice.
Is this something you can fix, e.g. by performing a check if column already exists, and if so not add it again. It does work fine when not using stored procedures.
Best regards
Pål