Dynamic Update Statements and Property Table Information

Dynamic Update Statements and Property Table Information

Old forum URL: forums.lhotka.net/forums/t/12120.aspx


bigphildogg86 posted on Monday, August 19, 2013

Hi all!  I have been working with CSLA for over a year now and have typically used the model of having insert, update and selection stored procedures.  But for flexibility I had heard that there was a way that the objects could dynamically save themselves without doing a stored procedure.  

Is there a structure in CSLA.NET 4 that would allow us to store table specific information for saving?  The other piece to this is that we have a front-end that the user can filter and completely change the criteria so for the Retrieve I am dynamically creating the Select statement and the front-end is passing in the Where clause.  However the where clause is going to have the property name and I'll need to translate that to table name and field name when it comes in.  

I looked around online and have been searching for any info on this but haven't come up with much.  

Any ideas on this?  Thanks in advance!  

JonnyBee replied on Monday, August 19, 2013

No, there is no structure in CSLA .NET where you can store this type of information. 

I have seen some project using NHibernate mappings by attributes but that would only work on the platforms that NHibernate support (and as such has nothing to do with CSLA .NET)

My preference is to use ObjectFactory or Repository pattern and keep the business objects as "clean" as possible. This means that the criteria representation that comes from the client must be processed on the DAL side to generate the actual where clause/select statement. This will work on ANY platform that CSLA .NET is available on. 

bigphildogg86 replied on Wednesday, August 21, 2013

Thanks!  I figured it couldn't hurt to ask as I was starting to get the impression after looking around that this wasn't available.  We'll be doing some mapping I think on the database side between object properties and their table and field names I think at this point. 

 

Thanks again!

Copyright (c) Marimer LLC