Denis,
Thank you for the answer.
Adding the [Field] attribute on the files property gets rid of the null error.
I added the [Field] attribute to the ParentFolder property but I get compiler error that
the [Field] declaration is not valid on this declaration type.
Here is the code:
[HierarchyRoot]
public class File : Entity
{
[Field, Key]
public int Id { get; private set; }
[Field(Length = 100)]
public string Name { get; set; }
[Field]
public Folder ParentFolder;
public File() : base()
{
}
public File(Session session): base(session)
{
}
}
I also having problems saving values to the backend database.
I am working on Asp.net project created with the DO Template for WebSite Application.
I am relying on the SessionManager, DomainBuilder, the code in the Global.asax file and the settings in the web.config file to handle automatic transactions and session management. The folowing code saves values to the database only once. Meaning no matter how many times I run the project it does not create a new record for the entities in the database. Everytime I run the project it takes the existing records and replaces them with the new values I specify in code.
Thank you for your help.
Here is the code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var session = Xtensive.Orm.Session.Current;
Folder folder = new Folder(session);
folder.Name = "Docs3";
File file = new File(session);
file.Name = "Agenda.doc";
folder.Files.Add(file);
}
}
The Folder.Files.Add(file) does not save the file entity to Files EntitySet.
answered
Jun 14 '13 at 16:05
rasxte
20●16●16●17