1.0.0-alpha-15 • Published 6 years ago
furystack-core v1.0.0-alpha-15
furystack-core
FuryStack framework, core package.
Model declaration with @PrimaryKey, @Property and @ForeignKey decorators:
class RefExample {
@PrimaryKey
public Id;
@Property
public Value: string;
}
class MyModel {
@PrimaryKey
public Id: number;
@Property
public MyPropertyA: string;
@Property
public MyPropertyB: string;
@ForeignKey(RefExample, 'RefExample')
public RefExampleId: number;
public RefExample: RefExample;
}
Accessing model metadata via Global ModelDescriptorStore, usage:
const descriptor = ModelDescriptorStore.GetDescriptor(MyModel);
/*
descriptor.Object = {constructor: class MyModel { … }}
descriptor.Entries = [
PrimaryKeyDescriptorEntry {PrimaryKey: "Id"}
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyA", EdmType: 0}
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyB", EdmType: 0}
ForeignKeyDescriptorEntry {ForeignKeyField: "RefExample", ReferenceName: "RefExample"}
]
descriptor..PrimaryKey = PrimaryKeyDescriptorEntry {PrimaryKey: "Id"}
descriptor.Properties = [
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyA", EdmType: 0}
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyB", EdmType: 0}
]
descriptor.ForeignKeys = [
ForeignKeyDescriptorEntry {ForeignKeyField: "RefExample", ReferenceName: "RefExample"}
]
*/
Setup and endpoint with the EndpointBuilder class:
const builder = new EndpointBuilder('api');
builder.EntityType(MyModel);
builder.EntityType(RefExample);
builder.EntitySet(MyModel, 'mymodels');
1.0.0-alpha-15
6 years ago
1.0.0-alpha-14
7 years ago
1.0.0-alpha-13
7 years ago
1.0.0-alpha-12
7 years ago
1.0.0-alpha-11
7 years ago
1.0.0-alpha-10
7 years ago
1.0.0-alpha-9
7 years ago
1.0.0-alpha-8
7 years ago
1.0.0-alpha-7
7 years ago
1.0.0-alpha-6
7 years ago
1.0.0-alpha-5
7 years ago
1.0.0-alpha-4
7 years ago
1.0.0-alpha-3
7 years ago
1.0.0-alpha-2
7 years ago
1.0.0-alpha-1
7 years ago