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.net
Meant to say I can't get to the internal methods
I'm assuming that the CustomerObject is being generated as an EditableChild and thus the factory methods are marked as Internal. You could change the business object types by changing the Entities.cst values via Manage Outputs. You would need to choose a DynamicListBase And\Or an EditableRoot business object \ businessObject list type.
I just used the QuikStart, seemed like the place to go for the first time. What is the intention of the quickstart? I will look at the other templates, do they do the object from a list of seleced tables? I generated a dynamicdata app using the plinq quckstart. Runs fine, but when I give the project to another developer who does not have CodeSmith installed he can't open it. Get's an error about missing codesmith.targets. It is not our intention that every developer will have CodeSmith. How do we get around this problem?
Also, the objects generated by the quickstart have everything marked as internal. Even if my customer is an editable child, wouldn't it be a chlid of the CustomerList? SO the CustomerList should have methods that are accessible by the UI but they are not???
Blake Niemyjski:unchecking Generate On Build
The reason we don't generate on build is because the header on every execution of the code generators files changes to update text at the top of each file [CodeSmith: vx.x.x, CSLA Templates: vx.0.0.0, CSLA Framework: vx.x.x.].
This would change with every upgrade of CodeSmith Generator software and the with source controlled solutions, just adds an inconsequential change to the history for the file, so we selectively decide when to re-generate the code, based on the changes to the templates and by monitoring the template issues online.
Jamie ClaytonSenior Application DeveloperJenasys Design
This could probably be changed. If the whole team is using the same version of templates and CodeSmith this shouldn't be an issue. If someone wants to submit this to Google code to exclude this information that would be cool. Then just place your vote. The only thing from a support perspective. This makes it much easier to see what version of CSLA you are targeting and what versions you are running.
The reason to not have the whole team running CodeSmith is $$$$$. We have two full time programmers in this group and 6-8 part time students that help out. We don't have the budget to pay for a tool we would never want the students to use anyway. I will try turning of the generation but I think I did that already
Thanks for your feedback, we are always willing to work with you when it comes to sales. Please see this (docs.codesmithtools.com/.../Using+a+Generator+Project+inside+Visual+Studio) for more information on disabling the Generate on build feature.
I did a lot of VB.net CSLA testing yesterday with r2497 of the templates. I've found a few bugs and reported them to Issues register.
Issue 627 - r2497 generates incorrect Business Rules namespace for VB.net (Patch included)
Issue 628 - CSLA vb.net r2497 Ignore Expression behaving badly.
Issue 629 - CSLA vb.net r2497 Selecting a Command (Stored Procedure) Fails
I also found the new View and Stored Procedure options hidden in this edition of the CSLA templates. WOOT! I found some further problems trying to use them, so it's not ready for use in the wild yet. Serious happy to see this coming through. You kept that quiet Blake
I've also got to say that the integration with VS 2010 is fantastic. I found the a problem in a *.cst, modified the template and regenerated in a few minutes. It took me longer to log the issue and send the svn patch file. The VS 2010 "Template Explorer" even shows all the SVN icons, so I know what I've change, now I'm syncing with repository.
ALL HAIL GALAXAR CODESMITH!
Sweet,
Thanks for logging those. I'm looking into them as we speak.
Turning off the generation at build is a necessary step but it does not solve the problem of opening the project for a user without CodeSmith. If I don't have CodeSmith loaded on my pc then I get the error about missing codesmith.targets when the project loads. At this point the project is not loaded and I can't work with the generated objects. Our intention is to have a couple of people who design and generate the objects but other people will be working with them, adding business rules etc. So it is necessary for these other people to be able to open the projects and add their code. If we can't do this with CodeSmith then we have to scratch this off our list of possible code generators for our use.
That's exciting news. I had looked at CS/CSLA about a year ago but really need the ability to work from views and stored procedures. Lack of that feature prevented me from moving forward. I was hoping this feature was in place by now but at least it is almost there. Tables just don't map to objects directly so views/sp are workarounds. Even better might be generating from Entity Framework????
When you turn off generating on build, it removes all CodeSmith Generator references including the targets files. If you have multiple csp's in a project then you will need to ensure they are all set to not generate on build.
If all of them are set to not generate on build, and you are still getting this targets issue, then please send support your vsproject file only and we will take a look.