LLBLGen 3.1 Final
SQL Server 2008
LLBLGenPro Framework Self-Servicing
.NET Framework 4.0
I'm trying to insert an entity using WCF Ria Services with LLBLGen. This is my first attempt at using ria services so I'm probably missing something fundamental. Any help is appreciated.
I followed the docs (http://www.llblgen.com/documentation/3.1/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_wcfriaservices.htm) for setting up the DomainService class including the config file.
The Asset entity is quite simple with the primary key being a SQL Server identity column (seed of 1).
DomainService:
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports SD.LLBLGen.Pro.RiaSupportClasses
Imports Test.Library.HelperClasses
Imports Test.Library.EntityClasses
Imports Test.Library.Linq
Imports System.Linq
Namespace Web
<EnableClientAccess()>
Public Class TestDomainService
Inherits LLBLGenProDomainService
Protected Overrides Function CreateTransaction() As SD.LLBLGen.Pro.ORMSupportClasses.ITransaction
Return New Transaction(System.Data.IsolationLevel.Serializable, "test")
End Function
Protected Overrides Sub UpdateEntity(toSave As SD.LLBLGen.Pro.ORMSupportClasses.IEntityCore)
Me.UpdateEntity(toSave)
End Sub
Public Function GetAssets() As IQueryable(Of AssetEntity)
Return New LinqMetaData(CreateTransaction).Asset
End Function
Public Sub InsertAsset(toInsert As AssetEntity)
Me.InsertEntity(toInsert)
End Sub
Public Sub UpdateAsset(toUpdate As AssetEntity)
Me.UpdateEntity(toUpdate)
End Sub
End Class
End Namespace
The SilverLight code:
Dim ctx As New TestDomainContext
Dim Asset As New AssetEntity()
With Asset
.OriginalFileName = "File Name"
.FileId = Guid.NewGuid()
.Name = "Other Name"
.OriginalSizeKb = 100
.OrganizationId = 7
End With
ctx.AssetEntities.Add(Asset)
ctx.SubmitChanges()
When I run the Silverlight Business app and try to Add the Asset entity I get the following error (stack trace attached):
The field 'AssetId' is read-only and can't be changed.
BTW, GetAssets works fine so I am able to communicate with the service.
Thanks in advance for any help!
Attachments
Filename |
File size |
Added on |
Approval |
StackTrace.txt
|
6,137 |
02-May-2011 19:54.54 |
Approved |