Brian,
Thanks for posting this.
I just ran into a problem with detecting the underlying object type for a Csla2 Read Only Collection and was looking to drop you a line about it. If you are open to private emails then please send me one at
jfallon at purchasingnet dot com (relace the words at and dot with the appropriate symbols.)
I will check out the new code ASAP.
Joe
Update: The new code does not work correctly either. The List Property set has code like this:
//JF 12/22/06 - this code does not work for Csla2.ROC._indexedType = System.Windows.Forms.
ListBindingHelper.GetListItemType(value);===========================================================
But a few months ago you used code like this (which worked):
_indexedType = _list.GetType().GetProperty(
"Item", new Type[] { typeof(int) }).PropertyType;Why was it changed?
Have you tested it against Csla2 objects?
============================================================
Here are some values from my BO:
TransROC.TransInfo
This ROC has 2 records in it.
==============================================================================================================
base
BO.MyReadOnlyBase<BO.TransROC.TransInfo>
{BO.TransROC.TransInfo}
==============================================================================================================
? System.Windows.Forms.ListBindingHelper.GetListItemType(value);
{Name = "IReadOnlyObject" FullName = "Csla2.Core.IReadOnlyObject"}
[System.RuntimeType]: {Name = "IReadOnlyObject" FullName = "Csla2.Core.IReadOnlyObject"}
base {System.Reflection.MemberInfo}: {Name = "IReadOnlyObject" FullName = "Csla2.Core.IReadOnlyObject"}
Assembly: {Csla2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7cda65b4773872e9}
AssemblyQualifiedName: "Csla2.Core.IReadOnlyObject, Csla2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7cda65b4773872e9"
Attributes: Public | ClassSemanticsMask | Abstract
BaseType: null
ContainsGenericParameters: false
DeclaringMethod: 'System.Windows.Forms.ListBindingHelper.GetListItemType(value).DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
DeclaringType: null
FullName: "Csla2.Core.IReadOnlyObject"
GenericParameterAttributes: 'System.Windows.Forms.ListBindingHelper.GetListItemType(value).GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'
GenericParameterPosition: 'System.Windows.Forms.ListBindingHelper.GetListItemType(value).GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'
GUID: {ed6826ef-59b7-3a57-a538-c69ac3002083}
HasElementType: false
IsAbstract: true
IsAnsiClass: true
IsArray: false
IsAutoClass: false
IsAutoLayout: true
IsByRef: false
IsClass: false
IsCOMObject: false
IsContextful: false
IsEnum: false
IsExplicitLayout: false
IsGenericParameter: false
IsGenericType: false
IsGenericTypeDefinition: false
IsImport: false
IsInterface: true
IsLayoutSequential: false
IsMarshalByRef: false
IsNested: false
IsNestedAssembly: false
IsNestedFamANDAssem: false
IsNestedFamily: false
IsNestedFamORAssem: false
IsNestedPrivate: false
IsNestedPublic: false
IsNotPublic: false
IsPointer: false
IsPrimitive: false
IsPublic: true
IsSealed: false
IsSerializable: false
IsSpecialName: false
IsUnicodeClass: false
IsValueType: false
IsVisible: true
MemberType: TypeInfo
Module: {Csla2.dll}
Namespace: "Csla2.Core"
ReflectedType: null
StructLayoutAttribute: null
TypeHandle: {System.RuntimeTypeHandle}
TypeInitializer: null
UnderlyingSystemType: {Name = "IReadOnlyObject" FullName = "Csla2.Core.IReadOnlyObject"}
==============================================================================================================
props {System.ComponentModel.PropertyDescriptorCollection} System.ComponentModel.PropertyDescriptorCollection
Count 0 int
Brian,
I looked for the Private Message link before and missed it. I will drop you a line tomorrow.
BTW, My BO is named:
TransROC.TransInfo
and it has a standard Integer Item property inherited from the framework.
The big problem is that your new code thinks the BO is IReadOnly instead of TransROC.TransInfo.
I have no idea why it is doing that.
I will send you more details in the morning.
Joe
Brian,
I sent you a PM on this.
The issue is that I have implemented an Interface that includes an overloaded Item Property. See the PM for details.
Joe
Hey Brian, first let me start by thanking you. Many of your posts have lent themselves well to understanding some of the nuances of the CSLA.
That being said, most of us here at my office are VB .NET developers, and would find it very useful to have a VB version of your ObjectListView. It appears that some of the CSLA Contrib code has a VB version, but I was unable to locate a VB version of your ObjectListView. Do you know of anyone that may have such a version?
You would do that for us lowly VB.NET developers ;-)
You, my friend, truly are a rock star.
Where can I download the latest ObjectListView classes? I found them for 1.5.x, is this the latest version? For some reason I can't find any information on the ObjectListView classes on the contrib site.
Thanks.
Brian,
I had an instance of an ObjectListView inside one of my BOs and that broke its ability to be serialized. Is there any reason the ObjectListView is not marked as Serializable?
Joe
OK.
I worked around the issue anyway.
===================================================================
I found a small problem with the ObjectListView this morning.
The ObjectViewLibrary is not sorting the way I expect it to.
If all the values are different then it sorts perfectly.
But if some of the values on the original collection are “tied” with each other (e.g. all have the same code) then the sorted view of the collection had the ties in inverted order.
For example:
Original collection has 6 BOs with codes: A,B, C(1), C(2), C(3), D.
The sorted collection inverts the C’s so it looks like this: A,B, C(3), C(2), C(1), D.
This makes new rows on the screen get added above existing rows and then screws up databinding as the indexes are out of sequence between the original collection and the sorted list.
I modified the code so that ties are placed at the end of the list and now the sorted list is in the same sequence as the original list.
In the method InsertInOrder I changed:
if (comparison == 0)Joe
Copyright (c) Marimer LLC