Jeff-Lewis / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

PLINQO - 'AddRules' Partial methods for Manager classes not generating? #159

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download PLINQO nightly build.
2. Open 'QuickStart.cst' from the downloaded templates root.
3. Select database (schema script attached).
4. Change Query Pattern from QueryExtensions to ManagerClasses.
5. Fill in other required fields and click Generate.
6. Open the generated solution, hit F5 to generate code and compile the 
solution. Everything works 100% here.

6. Now open the 'ProductsManager.cs' file.
7. Implement the AddRules partial method from this example : 
http://community.codesmithtools.com/wikis/plinqo/managers-template.aspx. 

8. Now the compile throws error : 'No defining declaration found for 
implementing declaration of partial method 
'Spaceballs.Data.ProductsManager.AddRules()'

9. Doing a solution-wide text search for 'AddRules' only yields the method 
we added above in step 7.

What is the expected output? What do you see instead?
Once we add the AddRules method in step 7 the solution should compile and 
the rules should work.

What version of the product are you using?
CodeSmith 5.1.6 rev 9466
PLINQO nightly build r996
Visual Studio Team System 2008
SQL 2008
Windows 7 x64

Please provide any additional information below.
I have attached the database schema and the solution it generates on my 
system (including the AddRules method in the 'ProductsManager.cs' file.

Original issue reported on code.google.com by noo...@gmail.com on 7 Oct 2009 at 4:09

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

The AddSharedRules partial methods should be placed in the entity classes.

Update the method to look like the following

        static partial void AddSharedRules()
        {
            // Rule allows the Name property to be a max of 150 characters.
            RuleManager.AddShared<Products>(new LengthRule("Name", 150));
        }

and place it in the Products entity class and let me know if that works for you.

Original comment by shannon....@gmail.com on 7 Oct 2009 at 4:51

GoogleCodeExporter commented 9 years ago
Thank you for the quick response - that works perfectly. Do you think the WIKI 
page 
should be updated to reflect this?

Thanks again.

Original comment by noo...@gmail.com on 7 Oct 2009 at 9:25

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 8 Oct 2009 at 10:13

GoogleCodeExporter commented 9 years ago
http://plinqo.com/Features.ashx#rules gives a quick overview of the rules.

Original comment by shannon....@gmail.com on 9 Oct 2009 at 6:54