public MetadataPropertyViewModel(EntityCommonViewModel parent, Property model, object value)
        {
            this.model  = model ?? throw new ArgumentNullException("model");
            this.parent = parent ?? throw new ArgumentNullException("parent");
            this.Value  = value;
            SetupValueView();

            //TODO: get real value of the property from database !
            //this.Value = typeof(Entity).GetProperty(model.Name).GetValue(model.Entity);

            //if (model.Relations.Count == 0)
            //{
            //    this.Type = null;
            //    this.Value = null;
            //}
            //else if (model.Relations.Count == 1)
            //{
            //    this.Type = model.Relations[0].Entity;
            //    this.Value = Entity.GetDefaultValue(this.Type);
            //}
            //else
            //{
            //    this.Type = Entity.Object;
            //    this.Value = null;
            //}
            //OnTypeSelected(this.Type);

            this.ClearValueCommand = new DelegateCommand(this.ClearValue);
            this.OpenReferenceObjectDialogCommand = new DelegateCommand(this.OpenReferenceObjectDialog);
        }
Пример #2
0
 public EntityCommonView(EntityCommonViewModel viewModel)
 {
     this.DataContext = viewModel;
     InitializeComponent();
 }