I have used CSLA for many years but am new to CodeSmith. I used the csla quickstart to generate an object from my db named Customer. It has a CustomerId as primary key. I have an asp project to consume the object. I add a CSLA datasource to the page and configure is by selecting either Customer or CustomerList from the available choices. Now I add a formview and connect it to the datasource. It generates the initila item view as expected. When I try to enter code in the SelectObject event to load the object there are no methods available to do so. Looking at the generaed code all of the factory methods are internal so I can get to them from the UI. How am I supposed to instantialte objects from the UI? Is it expected that everything will always be done through the collection objects?
barryfz
Hello,
The CSLA Templates look at the database relationships and try to make assumptions on business object types for you. CSLA has many different business object types and each have a different role (www.lhotka.net/.../CSLA4CheatSheet.pdf). A Child is meant to be internal and be populated by a parent object. Thus you can only access data on it. If you wish to use a public factory method then you need to change the business object type.
You can remove the CodeSmith Generator dependency on your projects by right clicking the CSP file and unchecking Generate On Build. I'm curious as to why you don't want your team to have CodeSmith Generator installed?
Blake Niemyjski CodeSmith Tools, LLC. Software Development Engineer Blog: http://windowscoding.com/blogs/blake/ .NetTiers team | Visit http://www.nettiers.com
We've looked into generating from Entity Framework and extending the designer but it just doesn't allow for that much flexibility as a designer when dealing with CSLA where you might have the same resource (table) being used for multiple different BO Types.
With the latest version of the templates, you could generate off of an EDMX with a bit of work / modification. You would need to take a look at the latest ef templates (edmx template) for more information.