This is a migrated thread and some comments may be shown as answers.

Beginning Error in n-tier application of ORM?

1 Answer 125 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cole
Top achievements
Rank 1
Cole asked on 13 Jan 2009, 07:26 PM
Hey all,
I am getting an error when I attempt to do a basic "Customer" insert using the Telerik ORM in a website.

I have 4 facets to my site...

TestProject.Web
TestProject.Data
TestProject.Services
TestProject.Test

TestProject.Data has the objects created by the wizard in the DB->classes approach.  TestProject.Services is the location of my actual code for using the object.  For example, the web has an IAuthService which has a method "InsertTestSubject()" which is...
public bool InserTestSubject() { 
            IObjectScope scope = Database.Get("DatabaseConnection1").GetObjectScope(); 
            //you could see in some expamples that this can also be done with    
            //Database.Get("DatabaseConnection1").GetObjectScope();   
            //there is absolutely no diference   
            using (scope) 
            { 
                scope.Transaction.Begin(); 
                Customer c = new MyProject.Data.Model.Customer(); 
                c.FName = "Joe"
                c.LName = "Test"
                c.PassEncrypted = "testpass"
                 
                scope.Add(c); 
                scope.Transaction.Commit();   
            } 
            return true
        } 

When I run this code in my website I get the following error:
Server Error in '/' Application. 
-------------------------------------------------------------------------------- 
 
Expected attribute 'name' in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\acb7afa6\3da5a3c9\assembly\dl3\02efd698\f650932c_f574c901\TestProject.Data.DLL:(resource)TestProject.Data.App.config:mapping-id=mssqlMapping:package[TestProject.Data.Model]/class[].class  
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  
 
Exception Details: Telerik.OpenAccess.OpenAccessException: Expected attribute 'name' in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\acb7afa6\3da5a3c9\assembly\dl3\02efd698\f650932c_f574c901\TestProject.Data.DLL:(resource)TestProject.Data.App.config:mapping-id=mssqlMapping:package[TestProject.Data.Model]/class[].class 
 
Source Error:  
 
 
Line 12:     { 
Line 13:         public bool InsertTestUser() { 
Line 14:             IObjectScope scope = Database.Get("DatabaseConnection1").GetObjectScope(); 
Line 15:             //you could see in some expamples that this can also be done with    
Line 16:             //Database.Get("DatabaseConnection1").GetObjectScope();   
  
 
Source File: C:\Projects\TstProject\TestProject\TestProject.Services\Authentication\AuthenticationService.cs    Line: 14  
 
Stack Trace:  
 
 
[OpenAccessException: Expected attribute 'name' in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\acb7afa6\3da5a3c9\assembly\dl3\02efd698\f650932c_f574c901\TestProject.Data.DLL:(resource)TestProject.Data.App.config:mapping-id=mssqlMapping:package[TestProject.Data.Model]/class[].class] 
   Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28 
   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34 
   OpenAccessRuntime.metadata.parser.MetaDataParser.getReqAttr(SaxAttributesSupport attr, String name) +275 
   OpenAccessRuntime.metadata.parser.MetaDataParser.startClass(SaxAttributesSupport attr) +434 
   OpenAccessRuntime.metadata.parser.MetaDataParser.startElementImp(String uri, String localName, String name, SaxAttributesSupport attr) +374 
   OpenAccessRuntime.metadata.parser.MetaDataParser.startElement(String uri, String localName, String name, SaxAttributesSupport attr) +75 
 
[OpenAccessException: startElement] 
   Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28 
   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34 
   OpenAccessRuntime.metadata.parser.MetaDataParser.startElement(String uri, String localName, String name, SaxAttributesSupport attr) +142 
   OpenAccessRuntime.metadata.parser.MetaDataParser._parse(XmlReader reader) +409 
   OpenAccessRuntime.metadata.parser.MetaDataParser._parse(XmlNode mappingXmlNode) +72 
   OpenAccessRuntime.metadata.parser.MetaDataParser.parse(XmlNode mappingXmlNode, String name) +83 
 
[OpenAccessException: : startElement] 
   Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28 
   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34 
   OpenAccessRuntime.metadata.parser.MetaDataParser.parse(XmlNode mappingXmlNode, String name) +184 
   Telerik.OpenAccess.RT.DatabaseAdapter.ConvertMappingXmlNodes2JdoRoots(ArrayList mappingXmlNodes, ArrayList mappingSources, ArrayList jdoRootsArrayList) +283 
   Telerik.OpenAccess.RT.DatabaseAdapter.GetConfigProperties(ConfigManager configManager, String _url, String user, String password, String connectionId, ArrayList jdoRootsArrayList) +297 
   Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open) +431 
   Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider) +65 
   Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope() +37 
   Telerik.OpenAccess.Database.GetObjectScope() +34 
   TestProject.Services.Authentication.AuthenticationService.DoesUserAuthenticate(String email, String password) in C:\Projects\TstProject\TestProject\TestProject.Services\Authentication\AuthenticationService.cs:14 
   TestProject.MVC.Web.Controllers.AccountController.Login(String email, String password, Boolean rememberMe) in C:\Projects\TstProject\TestProject\TestProject.MVC.Web\App\Controllers\AccountController.cs:36 
   lambda_method(ExecutionScope , ControllerBase , Object[] ) +262 
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +51 
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(MethodInfo methodInfo, IDictionary`2 parameters) +568 
   System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9() +117 
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +305 
   System.Web.Mvc.<>c__DisplayClasse.<InvokeActionMethodWithFilters>b__b() +61 
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +305 
   System.Web.Mvc.<>c__DisplayClasse.<InvokeActionMethodWithFilters>b__b() +61 
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(MethodInfo methodInfo, IDictionary`2 parameters, IList`1 filters) +455 
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +736 
   System.Web.Mvc.Controller.ExecuteCore() +180 
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +96 
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +36 
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +377 
   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +71 
   System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +36 
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
 
  
 
 
-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053  


Can anyone assist me in what I am doing wrong?  After the above method I woudl assume I delegate all the work to the Telerik ORM tool.

R.

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 14 Jan 2009, 02:26 PM
Hello Robin,

I am unable to resolve the problem only by looking at the code snippet you have posted. Please send us a support ticket and attach your app.config and reversemapping.config files in a zip archive so I can evaluate the error.

Greetings,
Alexander
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Development (API, general questions)
Asked by
Cole
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or