Hi guys,
I created this Item via Code-first:
[Name("Attraktion")]
[Category("Code-first")]
[AreaRule, StructureRule(Dynamicweb.Content.Items.Activation.StructureContextType.Pages, Dynamicweb.Content.Items.Activation.StructureContextType.ItemList),
ParentRule(Dynamicweb.Content.Items.Activation.ParentRestrictionRule.ParentType.RegularPage),
ChildRule(true),
TitlePattern("{{Name}}"),
TitleField("Name")]
public class Attraction : ItemEntry
{
[Group("Adresse")]
[Field("Navn", typeof(Dynamicweb.Content.Items.Editors.TextEditor))]
public string Name { get; set; }
[Group("Adresse")]
[Field("Vejnavn")]
public string Road { get; set; }
[Group("Adresse")]
[Field("Postnummer")]
public string Zipcode { get; set; }
[Group("Adresse")]
[Field("By")]
public string City { get; set; }
[Group("Adresse")]
[Field("Latitude")]
public string Latitude { get; set; }
[Group("Adresse")]
[Field("Longitude")]
public string Longitude { get; set; }
[Field("Beskrivelse", typeof(Dynamicweb.Content.Items.Editors.RichTextEditor))]
public string Description { get; set; }
[Field("Website")]
public string Website { get; set; }
[Field("Billede", typeof(Dynamicweb.Content.Items.Editors.FileEditor))]
public string Image { get; set; }
[Field("Tags", typeof(Dynamicweb.Content.Items.Editors.EditableListEditor))]
public IList Tags { get; set; }
public override void Save()
{
string[] coordinates = AppHelper.FindCoordinate(this.Road, this.Zipcode, this.City);
if (coordinates[0] != "0" && coordinates[1] != "0") {
Latitude = coordinates[0];
Longitude = coordinates[1];
}
base.Save();
}
public override void Delete()
{
base.Delete();
}
And as you can see, i'm trying to look up a coordinate whenever i save the item. My problem is that my Save() method is never reached, i tried simpler logic, and setting break points. I don't get errors in backend, but my own logic just isn't run.
Isn't the save method supposed to be called when i save or update an item in the backend?
// Martin