You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<sup><ahref='https://github.com/JasperFx/marten/blob/master/src/samples/MinimalAPI/Program.cs#L56-L62'title='Snippet source file'>snippet source</a> | <ahref='#snippet-sample_using_webapplication_2'title='Start of snippet'>anchor</a></sup>
37
37
<!-- endSnippet -->
38
38
39
-
Once the _Marten.CommandLine_ Nuget is installed and Oakton is handling your command line parsing, you should be able to see the Marten commands by typing `dotnet run -- help`in the command line terminal of your choice at the root of your project:
39
+
In your command line in the project directory, you can run:
check-env Execute all environment checks against the application
55
+
codegen Utilities for working with JasperFx.CodeGeneration and JasperFx.RuntimeCompiler
56
+
db-apply Applies all outstanding changes to the database(s) based on the current configuration
57
+
db-assert Assert that the existing database(s) matches the current configuration
58
+
db-dump Dumps the entire DDL for the configured Marten database
59
+
db-list List all database(s) based on the current configuration
60
+
db-patch Evaluates the current configuration against the database and writes a patch and drop file if there are any differences
61
+
describe Writes out a description of your running application to either the console or a file
62
+
help List all the available commands
63
+
projections Asynchronous projection and projection rebuilds
64
+
resources Check, setup, or teardown stateful resources of this system
65
+
run Start and run this .Net application
66
+
storage Administer the Wolverine message storage
67
+
```
68
+
69
+
For any of the listed commands, you can run:
70
+
71
+
`dotnet -- help`*`command`*
72
+
73
+
To see more information about the use of that command.
74
+
75
+
76
+
77
+
## Example Commands
78
+
79
+
Run these commands in your project's directory.
80
+
81
+
### List Your Projections
82
+
```bash
83
+
dotnet run -- projections list
84
+
```
85
+
86
+
### Rebuild Your Projections
87
+
88
+
To rebuild *all* of your projections:
89
+
90
+
```bash
91
+
dotnet run -- projections rebuild
92
+
```
93
+
To rebuild a single projection:
94
+
95
+
```bash
96
+
dotnet run -- projections -p Course rebuild
97
+
```
98
+
(where `Course` is the name of the projection, from the list)
99
+
100
+
### Creating a SQL Script from your Marten Database
101
+
102
+
```sh
103
+
dotnet run -- db-dump -d Marten ./marten.sql
104
+
```
105
+
### Codegen
106
+
107
+
You can use the CLI to preview, generate, write, or test the code generation:
108
+
109
+
To Test Codegen:
110
+
111
+
```bash
112
+
dotnet run -- codegen test
113
+
```
114
+
115
+
To preview codegen:
116
+
117
+
```bash
118
+
dotnet run -- codegen preview
119
+
```
120
+
121
+
To write the codegen to your project (in the `internal/codegen` directory):
122
+
123
+
```bash
124
+
dotnet run -- codegen write
125
+
```
126
+
127
+
128
+
## Outside the Dotnet CLI
129
+
57
130
If you're not using the dotnet CLI yet, you'd just need to compile your new console application like you've always done and call the exe directly. If you're familiar with the *nix style of command-line interfaces ala Git, you should feel right at home with the command line usage in Marten.
58
131
59
132
For the sake of usability, let's say that you stick a file named "marten.cmd" (or the *nix shell file equivalent) at the root of your codebase like so:
0 commit comments