Skip to content
This repository was archived by the owner on Apr 10, 2021. It is now read-only.

Commit 0d79bf6

Browse files
committed
add docs
1 parent d164d22 commit 0d79bf6

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

RawCMS.sln

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29806.167
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.1000
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RawCMS", "RawCMS\RawCMS.csproj", "{0173DCCE-34BA-4988-BA6C-07880C3F71A0}"
77
EndProject
@@ -50,6 +50,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{5257BA
5050
ProjectSection(SolutionItems) = preProject
5151
docs\assets\auth0-new-api.png = docs\assets\auth0-new-api.png
5252
docs\assets\auth0-new-application.png = docs\assets\auth0-new-application.png
53+
docs\assets\jsLambdas.png = docs\assets\jsLambdas.png
5354
EndProjectSection
5455
EndProject
5556
Global

docs/Data-process-Lambda.md

+35-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
Data processing Lambdas are used to alter regular save behaviour. Using such lambdas you can:
2-
* compute some value
3-
* add some validation step
4-
* add per-user filters
5-
* hide fields
6-
* everithing else you need
2+
3+
- compute some value
4+
- add some validation step
5+
- add per-user filters
6+
- hide fields
7+
- everithing else you need
78

89
### Data saving pipeline
10+
911
Data is saved using a save pipeline. Current implemented stages are:
1012

1113
1. Pre-Save
1214
2. Post-Save
1315

1416
### DataProcessLambda
17+
1518
Implementing a DataProcessLambda will let you choose in which phases you want to be triggered. Multiple phases can be binded as in example
1619

1720
```cs
18-
public class AuditLambda : DataProcessLambda
21+
public class AuditLambda : DataProcessLambda
1922
{
2023
public override string Name => "LogLambda";
2124
public override string Description => "Log all";
@@ -28,11 +31,12 @@ Implementing a DataProcessLambda will let you choose in which phases you want to
2831
```
2932

3033
### PostSaveLambda, PreaveLambda
34+
3135
This class is shortcut to bind presave or postsave event
3236

3337
Audit Lambda is a sample. It is triggered on before saving data and it set audit details.
3438

35-
```cs
39+
```cs
3640
public class AuditLambda : PreSaveLambda
3741
{
3842
public override string Name => "AuditLambda";
@@ -52,3 +56,27 @@ Audit Lambda is a sample. It is triggered on before saving data and it set audit
5256
}
5357
```
5458

59+
### Javascript Lambdas
60+
61+
For entities is possible define custom lambdas writed on javascript language on this events:
62+
63+
- PreSave
64+
- PostSave
65+
- PreDelete
66+
- PostDelete
67+
68+
![JS Lambdas](assets/jslambdas.png)
69+
70+
this is an example of javascript code for calculate preview book using ISBN code
71+
72+
```js
73+
var client = new RAWCMSRestClient();
74+
var request = new RAWCMSRestClientRequest();
75+
var bibkey = "ISBN:" + item.ISBN13;
76+
request.Url = "https://openlibrary.org/api/books?format=JSON&bibkeys=" + bibkey;
77+
request.Method = "GET";
78+
var response = client.Execute(request);
79+
var data = JSON.parse(response.Data);
80+
//set result propoerty
81+
item.PreviewUrl = data[bibkey].preview_url;
82+
```

docs/assets/jsLambdas.png

67 KB
Loading

0 commit comments

Comments
 (0)