DataPortal.Create Failed (C#)

DataPortal.Create Failed (C#)

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


ppcuban posted on Wednesday, November 01, 2006

Hello.

i am trying to use the csla framework and when i am trying to create a new object i get this exception. I used the Project Class (from the book Expert C# Business Object 2005) as a model to create my own class. I can't figure out what's going on.

Michael Hildner replied on Wednesday, November 01, 2006

Hi,

Check out the DataPortalException.BusinessException - it gives you more details than the generic failed message.

Regards,

Mike

guyroch replied on Wednesday, November 01, 2006

Can you post your exception, this way we might be able to better understand your issue.

Thanks

ppcuban replied on Wednesday, November 01, 2006

{"DataPortal.Create failed on the server"}

"   at Csla.Utilities.CallByName(Object target, String methodName, CallType callType, Object[] args) in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\Utilities.cs:line 26\r\n   at Csla.Validation.CommonRules.StringRequired(Object target, RuleArgs e) in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\Validation\\CommonRules.cs:line 26\r\n   at Csla.Validation.RuleMethod.Invoke() in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\Validation\\RuleMethod.cs:line 83\r\n   at Csla.Validation.ValidationRules.CheckRules() in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\Validation\\ValidationRules.cs:line 166\r\n   at IFG.Library.UserMain.DataPortal_Create(Criteria criteria) in C:\\Documents and Settings\\JFERNANDEZ\\My Documents\\Visual Studio 2005\\Projects\\IFG\\IFG\\IFG.Library\\UserMain.cs:line 652\r\n   at Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\DataPortal\\MethodCaller.cs:line 56\r\n   at Csla.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\DataPortal\\MethodCaller.cs:line 37\r\n   at Csla.Server.SimpleDataPortal.Create(Type objectType, Object criteria, DataPortalContext context) in C:\\Documents and Settings\\JFERNANDEZ\\Desktop\\1-59059-632-3-2\\csla20cs\\Csla\\DataPortal\\Server\\SimpleDataPortal.cs:line 43"

guyroch replied on Thursday, November 02, 2006

Your exception appears to be around your ValidationRules. 

You said that you were using the "Project Class" from the book as an example.  Have you downloaded the Project Tracker sample code in installed first OR are you re-coding the class from reading the book?  If you haven't downloaded the Project Tracker sample application do it now and make it work first, then you can _explore_ doing more. 

http://www.lhotka.net/cslanet/download.aspx

Hope this helps

Copyright (c) Marimer LLC