Templates icon indicating copy to clipboard operation
Templates copied to clipboard

CSLA - Stored procedures insert sql is generated with computed fields.

Open niemyjski opened this issue 5 years ago • 2 comments

The SQLStoredProcedures template (https://github.com/codesmithtools/Templates/blob/master/Templates/Frameworks/Csla/CSharp/DataAccessLayer/Internal/SQLStoredProcedures.cst) is including computed properties in the updated sql and in code: https://github.com/codesmithtools/Templates/search?q=GetUpdateStoredProcedureName&unscoped_q=GetUpdateStoredProcedureName

We'd need to update the instances above to filter out computed properties in all spots. We could do this by changing Entity.Properties to Entity.GetProperties(PropertyType.UpdateInsert). We'd accept a pr for this.

niemyjski avatar Apr 20 '20 14:04 niemyjski

Currently the business objects also output all the fields including read-only fields when calling stored procedures. I'm assuming the business objects won't change so the stored procedures would have to accept the same parameters, but would just ignore the calculated fields when executing updates and inserts.

fundez avatar Apr 29 '20 18:04 fundez

It definitely needs a filtered list, I guess it doesn't hurt to pass all of them to the stored procedure (really stinks), but is a quick work around. Could you try updating the stored procedure update statement using the above calls.

niemyjski avatar Apr 30 '20 12:04 niemyjski