View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints; | |
using FastEndpoints.Swagger; | |
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddFastEndpoints(); | |
builder.Services.AddSwaggerDoc(tagIndex: 0); | |
var app = builder.Build(); | |
app.UseAuthorization(); | |
app.UseFastEndpoints(); |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global using FastEndpoints; | |
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddFastEndpoints(); | |
var app = builder.Build(); | |
app.UseAuthorization(); | |
app.UseFastEndpoints(); | |
Task.Run(async () => |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Bson; | |
using MongoDB.Entities; | |
using System; | |
using System.IO; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace TestApplication | |
{ | |
public static class Program |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Bson; | |
using MongoDB.Driver; | |
using MongoDB.Entities; | |
using System.Threading.Tasks; | |
namespace ReferencedRelationshipExample | |
{ | |
public class Author : Entity | |
{ | |
public string Name { get; set; } |
View Run.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Run | |
{ | |
private static bool IsDotNetFx => | |
RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); | |
private static readonly TaskFactory factory = | |
new TaskFactory( | |
CancellationToken.None, | |
TaskCreationOptions.None, | |
TaskContinuationOptions.None, |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Entities; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace TestApplication | |
{ | |
public static class Program | |
{ | |
public class Item : Entity | |
{ |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Entities; //https://mongodb-entities.com | |
using System; | |
using System.Threading.Tasks; | |
namespace TestApplication | |
{ | |
public class Message : Entity | |
{ | |
public string Content { get; set; } | |
public int Upvotes { get; set; } |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var username = "user"; | |
var password = "password"; | |
MongoInternalIdentity internalIdentity = new("auth_db_name", username); | |
PasswordEvidence passwordEvidence = new(password); | |
MongoCredential mongoCredential = new("SCRAM-SHA-1", internalIdentity, passwordEvidence); | |
await DB.InitAsync("DatabaseName", new MongoClientSettings | |
{ | |
Server = new MongoServerAddress("localhost", 27017), |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Entities; | |
using System; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace TestApplication | |
{ | |
public class UserActivity : Entity | |
{ | |
public string RawUrl { get; set; } |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MongoDB.Bson; | |
using MongoDB.Entities; | |
using System; | |
using System.IO; | |
using System.Threading.Tasks; | |
namespace TestApplication | |
{ | |
public class Book : Entity | |
{ |
NewerOlder