Hi,
I'm adding two related entities to a database both are new, but should be referenced:
            ProjectFileEntity ProjectFile = new ProjectFileEntity();
            ProjectFile.ProjectId = ProjectID;
            ProjectFile.DocumentTypeId = DocumentTypeID;
            ProjectFile.Description = Description;
            ProjectFile.CustomerDocNo = CustomerDocNo;
            ProjectFileVersionEntity ProjectFileVersion = new ProjectFileVersionEntity();
            ProjectFileVersion.ProjectFile = ProjectFile;
            ProjectFileVersion.FileVersion = FileVersion;
            ProjectFileVersion.Description = VersionDescription;
            ProjectFileVersion.UserId = UserID;
            ProjectFileVersion.FilePath = FilePath;
            ProjectFile.ProjectFileVersion.Add(ProjectFileVersion);
            // Save the entity
            return ProjectFile.Save(true);
When I run the Save command I get the following error:
An exception was caught during the execution of an action query: The field 'ProjectFileVersion.ProjectFileID' cannot contain a Null value because the Required property for this field is set to True.  Enter a value in this field.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
I thought according to the docu this should auto-sync itself.
I can't do it in two steps as I cant find the first entity back based on the properties that I have... There could be multiple ProjectFile entities in the database.
Could the problem be in Access? As I know that Access doesnt support the @@IDENTITY.
Is there a work around for this?
Martin
I'm using SelfServicing.