C# Class Breeze.Entities.BreezeEntityBuilder

Builds server-side entities from JSON results sent by the Breeze client. This class is thread-safe and can be used to handle multiple requests.
Show file Open project: Breeze/breeze.server.net

Public Properties

Property Type Description
jsonSerializer Newtonsoft.Json.JsonSerializer

Public Methods

Method Description
BreezeEntityBuilder ( List assemblies ) : Newtonsoft.Json

Create an instance using a list of assemblies to probe for entity types that match the entities from the client.

BreezeEntityBuilder ( string assemblyNameContains ) : Newtonsoft.Json

Create an instance using a string to match the assembly names. Matching assemblies will be probed for entity types that match the entities from the client.

BuildSaveWorkState ( Newtonsoft.Json.Linq.JObject saveBundle ) : SaveWorkState

Create a SaveWorkState from the JObject sent by the client.

BuildSaveWorkState ( List rawEntities ) : SaveWorkState

Create a SaveWorkState from the raw entities sent by the client.

Protected Methods

Method Description
BuildEntityGroups ( List rawEntities ) : List

Create EntityGroup objects from the raw entities sent by the client.

CreateEntityInfoFromJson ( dynamic jo, Type entityType ) : EntityInfo

Create an EntityInfo object from the raw client object

CreateJsonSerializerSettings ( ) : JsonSerializerSettings

Create breeze-friendly serializer settings

JsonToDictionary ( dynamic json ) : Object>.Dictionary

Convert the json object to a dictionary.

LookupEntityType ( string entityTypeName ) : Type

Get the C# type from the entity type name. Uses the modelAssemblies property to look up the entities.

Method Details

BreezeEntityBuilder() public method

Create an instance using a list of assemblies to probe for entity types that match the entities from the client.
public BreezeEntityBuilder ( List assemblies ) : Newtonsoft.Json
assemblies List List of assemblies to probe for entity types
return Newtonsoft.Json

BreezeEntityBuilder() public method

Create an instance using a string to match the assembly names. Matching assemblies will be probed for entity types that match the entities from the client.
public BreezeEntityBuilder ( string assemblyNameContains ) : Newtonsoft.Json
assemblyNameContains string String contained in the assembly name
return Newtonsoft.Json

BuildEntityGroups() protected method

Create EntityGroup objects from the raw entities sent by the client.
protected BuildEntityGroups ( List rawEntities ) : List
rawEntities List Objects assumed to have an entityAspect property containing the entityTypeName
return List

BuildSaveWorkState() public method

Create a SaveWorkState from the JObject sent by the client.
public BuildSaveWorkState ( Newtonsoft.Json.Linq.JObject saveBundle ) : SaveWorkState
saveBundle Newtonsoft.Json.Linq.JObject JObject deserialized from Breeze client
return SaveWorkState

BuildSaveWorkState() public method

Create a SaveWorkState from the raw entities sent by the client.
public BuildSaveWorkState ( List rawEntities ) : SaveWorkState
rawEntities List Objects assumed to have an entityAspect property containing the entityTypeName
return SaveWorkState

CreateEntityInfoFromJson() protected static method

Create an EntityInfo object from the raw client object
protected static CreateEntityInfoFromJson ( dynamic jo, Type entityType ) : EntityInfo
jo dynamic Object assumed to have an entityAspect property containing entityState and optional originalValuesMap and autoGeneratedKey
entityType System.Type Domain model object type to create
return EntityInfo

CreateJsonSerializerSettings() protected static method

Create breeze-friendly serializer settings
protected static CreateJsonSerializerSettings ( ) : JsonSerializerSettings
return Newtonsoft.Json.JsonSerializerSettings

JsonToDictionary() protected static method

Convert the json object to a dictionary.
protected static JsonToDictionary ( dynamic json ) : Object>.Dictionary
json dynamic Object assumed to be an IEnumerable containing JProperty objects
return Object>.Dictionary

LookupEntityType() protected method

Get the C# type from the entity type name. Uses the modelAssemblies property to look up the entities.
protected LookupEntityType ( string entityTypeName ) : Type
entityTypeName string Name in the form "Customer:#My.App.Namespace"
return System.Type

Property Details

jsonSerializer public static property

public static JsonSerializer,Newtonsoft.Json jsonSerializer
return Newtonsoft.Json.JsonSerializer