本文整理汇总了C#中NeoDatis.GetDefaultInstanciationClass方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetDefaultInstanciationClass方法的具体用法?C# NeoDatis.GetDefaultInstanciationClass怎么用?C# NeoDatis.GetDefaultInstanciationClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetDefaultInstanciationClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntrospectCollection
protected virtual NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo GetNativeObjectInfoInternal
(NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type, object o, bool recursive
, System.Collections.Generic.IDictionary<object, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
> alreadyReadObjects, NeoDatis.Odb.Core.Layers.Layer1.Introspector.IIntrospectionCallback
callback)
{
NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
if (type.IsAtomicNative())
{
if (o == null)
{
aoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NullNativeObjectInfo(type.GetId());
}
else
{
aoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo(o, type
.GetId());
}
}
else
{
if (type.IsCollection())
{
aoi = IntrospectCollection((System.Collections.ICollection)o, recursive, alreadyReadObjects
, type, callback);
}
else
{
if (type.IsArray())
{
if (o == null)
{
aoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ArrayObjectInfo(null);
}
else
{
// Gets the type of the elements of the array
string realArrayClassName = OdbClassUtil.GetFullName(o.GetType().GetElementType());
NeoDatis.Odb.Core.Layers.Layer2.Meta.ArrayObjectInfo aroi = null;
if (recursive)
{
aroi = IntrospectArray(o, recursive, alreadyReadObjects, type, callback);
}
else
{
aroi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ArrayObjectInfo((object[])o
);
}
aroi.SetRealArrayComponentClassName(realArrayClassName);
aoi = aroi;
}
}
else
{
if (type.IsMap())
{
if (o == null)
{
aoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.MapObjectInfo(null, type, type.GetDefaultInstanciationClass
().FullName);
}
else
{
MapObjectInfo moi = null;
string realMapClassName = OdbClassUtil.GetFullName(o.GetType());
bool isGeneric = o.GetType().IsGenericType;
if (isGeneric)
{
moi = new MapObjectInfo(IntrospectGenericMap((System.Collections.Generic.IDictionary<object,object>)o, recursive, alreadyReadObjects, callback), type, realMapClassName);
}
else
{
moi = new MapObjectInfo(IntrospectNonGenericMap((System.Collections.IDictionary)o, recursive, alreadyReadObjects, callback), type, realMapClassName);
}
if (realMapClassName.IndexOf("$") != -1)
{
moi.SetRealMapClassName(OdbClassUtil.GetFullName(type.GetDefaultInstanciationClass()));
}
aoi = moi;
}
}
else
{
if (type.IsEnum())
{
System.Enum enumObject = (System.Enum)o;
if (enumObject == null)
{
aoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NullNativeObjectInfo(type.GetSize(
));
}
else
{
Type t = enumObject.GetType();
string enumClassName = enumObject == null ? null : OdbClassUtil.GetFullName(enumObject.GetType());
// Here we must check if the enum is already in the meta model. Enum must be stored in the meta
// model to optimize its storing as we need to keep track of the enum class
// for each enum stored. So instead of storing the enum class name, we can store enum class id, a long
// instead of the full enum class name string
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = GetClassInfo(enumClassName);
//.........这里部分代码省略.........
示例2: while
private NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo IntrospectCollection
(System.Collections.ICollection collection, bool introspect, System.Collections.Generic.IDictionary
<object, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo> alreadyReadObjects
, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type, NeoDatis.Odb.Core.Layers.Layer1.Introspector.IIntrospectionCallback
callback)
{
if (collection == null)
{
return new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo();
}
// A collection that contain all meta representations of the collection
// objects
System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
> collectionCopy = new System.Collections.Generic.List<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
>(collection.Count);
// A collection to keep references all all non native objects of the
// collection
// This will be used later to get all non native objects contained in an
// object
System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
> nonNativesObjects = new System.Collections.Generic.List<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
>(collection.Count);
NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
System.Collections.IEnumerator iterator = collection.GetEnumerator();
while (iterator.MoveNext())
{
object o = iterator.Current;
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null;
// Null objects are not inserted in list
if (o != null)
{
ci = GetClassInfo(OdbClassUtil.GetFullName(o.GetType()));
aoi = GetObjectInfo(o, ci, introspect, alreadyReadObjects, callback);
collectionCopy.Add(aoi);
if (aoi.IsNonNativeObject())
{
// o is not null, call the callback with it
//callback.objectFound(o);
// This is a non native object
nonNativesObjects.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi
);
}
}
}
NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
(collectionCopy, nonNativesObjects);
string realCollectionClassName = OdbClassUtil.GetFullName(collection.GetType());
if (realCollectionClassName.IndexOf("$") != -1)
{
coi.SetRealCollectionClassName(type.GetDefaultInstanciationClass().FullName);
}
else
{
coi.SetRealCollectionClassName(realCollectionClassName);
}
return coi;
}