ObjectGenerator.GenerateObjectWithSample Method

Namespace:
Weavy.Web.Areas.Docs.Samples
Assembly:
Weavy.Web.dll

GenerateObjectWithSample(Type, IDictionary)

Generates an object for a given type. The type needs to be public, have a public default constructor and settable public properties/fields. Currently it supports the following types: Simple types: System.Int32, System.String, System.Enum, System.DateTime, System.Uri, etc. Complex types: POCO types. Nullables: System.Nullable%601. Arrays: arrays of simple types or complex types. Key value pairs: System.Collections.Generic.KeyValuePair%602 Tuples: System.Tuple%601, System.Tuple%602, etc Dictionaries: System.Collections.Generic.IDictionary%602 or anything deriving from System.Collections.Generic.IDictionary%602. Collections: System.Collections.Generic.IList%601, System.Collections.Generic.IEnumerable%601, System.Collections.Generic.ICollection%601, System.Collections.IList, System.Collections.IEnumerable, System.Collections.ICollection or anything deriving from System.Collections.Generic.ICollection%601 or System.Collections.IList. Queryables: System.Linq.IQueryable, System.Linq.IQueryable%601.

public object GenerateObjectWithSample(Type type, IDictionary<Type, object> samples)

Parameters

type
System.Type

The type.

samples
System.Collections.Generic.IDictionary

Static samples.

Returns

object

An object of the given type.