EntityType constructor
let entityType = new EntityType( {
shortName: "person",
namespace: "myAppNamespace"
});
Configuration settings or a MetadataStore. If this parameter is just a MetadataStore then what will be created is an 'anonymous' type that will never be communicated to or from the server. It is purely for client side use and will be given an automatically generated name. Normally, however, you will use a configuration object.
The AutoGeneratedKeyType for this EntityType. Read Only
The base EntityType (if any) for this EntityType. Read Only
The name of this EntityType's base EntityType (if any)
The DataProperties for this EntityType that contain instances of a ComplexType. Read Only
The DataProperties associated with this EntityType that are concurrency properties. Read Only
A free form object that can be used to define any custom metadata for this EntityType. Read Only
The DataProperties (see DataProperty associated with this EntityType. Read Only
The default resource name associated with this EntityType. An EntityType may be queried via a variety of 'resource names' but this one is used as the default when no resource name is provided. This will occur when calling EntityAspect.loadNavigationProperty or when executing any EntityQuery that was created via an EntityKey. Read Only
The DataProperties associated with this EntityType that are foreign key properties. Read Only
Whether this EntityType is abstract. Read Only
Whether this EntityType is anonymous. Anonymous types will never be communicated to or from the server. They are purely for client side use and are given an automatically generated name. Read Only
Always false for an EntityType.
Whether this EntityType has been 'frozen'. EntityTypes become frozen after the first instance of that type has been created and attached to an EntityManager.
The DataProperties associated with this EntityType that make up it's EntityKey. Read Only
The MetadataStore that contains this EntityType. Read Only
The fully qualified name of this EntityType. Read Only
The namespace for this EntityType. Read Only
The NavigationProperties (see NavigationProperty associated with this EntityType. Read Only
A function that is used to customize the serialization of any EntityProperties of this type.
The short, unqualified, name for this EntityType. Read Only
The DataProperties associated with this EntityType that are not mapped to any backend datastore. These are effectively free standing properties. Read Only
The entity level validators associated with this EntityType. Validators can be added and removed from this collection. Read Only.
Adds a DataProperty or a NavigationProperty to this EntityType.
// assume myEntityType is a newly constructed EntityType.
myEntityType.addProperty(dataProperty1);
myEntityType.addProperty(dataProperty2);
myEntityType.addProperty(navigationProperty1);
Adds either an entity or property level validator to this EntityType.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
let countryProp = custType.getProperty("Country");
let valFn = function (v) {
if (v == null) return true;
return (core.stringStartsWith(v, "US"));
};
let countryValidator = new Validator("countryIsUS", valFn,
{ displayName: "Country", messageTemplate: "'%displayName%' must start with 'US'" });
custType.addValidator(countryValidator, countryProp);
This is the same as adding an entity level validator via the 'validators' property of DataProperty or NavigationProperty
countryProp.validators.push(countryValidator);
Entity level validators can also be added by omitting the 'property' parameter.
custType.addValidator(someEntityLevelValidator);
or
custType.validators.push(someEntityLevelValidator);
Validator to add.
Property to add this validator to. If omitted, the validator is assumed to be an entity level validator and is added to the EntityType's 'validators'.
For use in pluggable adapters.
Create a new entity of this type.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getAsEntityType("Customer");
let cust1 = custType.createEntity();
em1.addEntity(cust1);
The new entity.
Returns the constructor for this EntityType.
Whether to ignore any cached version of this constructor. (default == false)
The constructor for this EntityType.
Returns a data property with the specified name or null.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
let customerNameDataProp = custType.getDataProperty("CustomerName");
A DataProperty or null if not found.
For use in pluggable adapters.
Returns a navigation property with the specified name or null.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
let customerOrdersNavProp = custType.getDataProperty("Orders");
A NavigationProperty or null if not found.
Returns all of the properties ( dataProperties and navigationProperties) for this EntityType.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
let arrayOfProps = custType.getProperties();
An array of Data and Navigation properties.
Returns either a DataProperty or a NavigationProperty with the specified name or null.
This method also accepts a '.' delimited property path and will return the 'property' at the end of the path.
let custType = em1.metadataStore.getEntityType("Customer");
let companyNameProp = custType.getProperty("CompanyName");
This method can also walk a property path to return a property
let orderDetailType = em1.metadataStore.getEntityType("OrderDetail");
let companyNameProp2 = orderDetailType.getProperty("Order.Customer.CompanyName");
// companyNameProp === companyNameProp2
A DataProperty or NavigationProperty or null if not found.
Returns all of the property names ( for both dataProperties and navigationProperties) for this EntityType.
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
let arrayOfPropNames = custType.getPropertyNames();
Returns an array containing this type and any/all subtypes of this type down thru the hierarchy.
Returns whether this type is a subtype of a specified type.
General purpose property set method
// assume em1 is an EntityManager containing a number of existing entities.
let custType = em1.metadataStore.getEntityType("Customer");
custType.setProperties( {
autoGeneratedKeyType: AutoGeneratedKeyType.Identity;
defaultResourceName: "CustomersAndIncludedOrders"
)};
a configuration object
Returns a string representation of this EntityType.
Generated using TypeDoc
Container for all of the metadata about a specific type of Entity.