Skip to content

Replies

0
Brian Fallon
Brian Fallon answered on Sep 22, 2015 3:25 PM

If changing the data type of the database column fixes the problem, the only logical conclusion is that the corresponding property in the entity framework implementation is of a type not compatible with integers. Search the entity framework implementation source code for the name of the database column in question, and take a look at each line of code in the search results; odds are you will see something in there that indicates a type disparity.

0
Brian Fallon
Brian Fallon answered on Sep 21, 2015 3:06 PM

https://msdn.microsoft.com/en-us/library/vstudio/ms173149(v=vs.100).aspx

Example:

    public class DerivedFromUltraComboEditor : UltraComboEditor
    {
        public string StringValue
        {
            get
            {
                object value = base.Value;
                return value == null ? string.Empty : value.ToString();
            }

            set
            {
                base.Value = value;
            }
        }

        public int IntegerValue
        {
            get
            {
                object value = base.Value;
                if ( value is int )
                    return (int)value;
                else
                    return 0;
            }

            set
            {               
                base.Value = value;
            }
        }
    }

0
Brian Fallon
Brian Fallon answered on Sep 18, 2015 9:13 PM

I'm not exactly following your description of the interactions between integers and strings in this scenario, but yes, there is a way to bind to an Int32 property…what you would need to do is derive a class from UltraComboEditor, and add a new settable public property to this derived class, let's call it 'IntValue', of type Int32. That property's implementation would simply get/set the value of the UltraComboEditor's Value property, cast to an integer.

0
Brian Fallon
Brian Fallon answered on Sep 17, 2015 7:10 PM

Please attach a sample demonstrating the issue so we can investigate.

0
Brian Fallon
Brian Fallon answered on Sep 17, 2015 3:09 PM

First thing that comes to mind is the 'ProducerTypeId' field is readonly. If 'Producer' in this context is a DataTable, check to see if the ReadOnly property on the 'ProducerTypeId' DataColumn returns true; if so, it is probably an identity column, which cannot be modified. If 'Producer' is an object, see if the 'ProducerTypeId' property is readonly.

If you've eliminated this possibility, it would be kind of impossible for us to guess what's going on there without a sample project.

0
Brian Fallon
Brian Fallon answered on Sep 15, 2015 10:21 PM

The bug is in your DynamicPropertyDescriptor class.

Your implementation of the GetValue method does not observe the value of the 'component' parameter, which in this scenario is not always the same as the value of the 'businessObject' member variable. I changed the implementation to use the component parameter instead, and the second row appeared correctly.

0
Brian Fallon
Brian Fallon answered on Sep 15, 2015 3:26 PM

I have to assume that you have attached the wrong sample here; this one has no class named 'Expando', and in fact nothing about it even remotely resembles the problem you describe here.