baristaner
baristaner
CC#
Created by baristaner on 1/11/2024 in #help
How can i use ASP.NET CORE Identity with JWT
Okay thanks
5 replies
CC#
Created by baristaner on 1/11/2024 in #help
How can i use ASP.NET CORE Identity with JWT
The token doesn't seem right to me and i can't decode it
5 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
i'm kinda new
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
oh yeah sorry
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
It creates the product in db but
Response body is {}
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
first time it didnt
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
and sql worked
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
i just clicked execute again
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
Wait
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
Honestly
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
my validators also not working
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
btw
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
It didn't convert datetime utc to json
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
nope 8.0
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
Here is my full program.cs
c#
using fastwin;
using Microsoft.EntityFrameworkCore;
using fastwin.Repository.Repositories;
using fastwin.Interfaces;
using FastWIN.API.Converters;
using FluentValidation.AspNetCore;
using FluentValidation;
using fastwin.Services;
using fastwin.Features.Products.Add.Validators;
using System.Reflection;
using MediatR;
using Microsoft.AspNetCore.Hosting;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter());
});

builder.Services.AddFluentValidationAutoValidation()
.AddFluentValidationClientsideAdapters()
.AddValidatorsFromAssemblyContaining<ProductValidator>();


builder.Services.AddMediatR(cfg => {
cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();



builder.Services.AddDbContext<CodeDbContext>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))
.LogTo(Console.WriteLine, LogLevel.Information);
});


builder.Services.AddScoped(typeof(IRepository<>), typeof(GenericRepository<>));
builder.Services.AddScoped<ProductService>();


var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
);



app.UseAuthorization();

app.MapControllers();

app.Run();
c#
using fastwin;
using Microsoft.EntityFrameworkCore;
using fastwin.Repository.Repositories;
using fastwin.Interfaces;
using FastWIN.API.Converters;
using FluentValidation.AspNetCore;
using FluentValidation;
using fastwin.Services;
using fastwin.Features.Products.Add.Validators;
using System.Reflection;
using MediatR;
using Microsoft.AspNetCore.Hosting;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonDateTimeConverter());
});

builder.Services.AddFluentValidationAutoValidation()
.AddFluentValidationClientsideAdapters()
.AddValidatorsFromAssemblyContaining<ProductValidator>();


builder.Services.AddMediatR(cfg => {
cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();



builder.Services.AddDbContext<CodeDbContext>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))
.LogTo(Console.WriteLine, LogLevel.Information);
});


builder.Services.AddScoped(typeof(IRepository<>), typeof(GenericRepository<>));
builder.Services.AddScoped<ProductService>();


var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
);



app.UseAuthorization();

app.MapControllers();

app.Run();
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
is this the correct way to inject mediart? Program.cs
c#
builder.Services.AddMediatR(cfg => {
cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
});
c#
builder.Services.AddMediatR(cfg => {
cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
});
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
it is kinda odd error
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
this is my internship assessment
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
i'm not working on a real project
76 replies
CC#
Created by baristaner on 1/4/2024 in #help
Implementing MediatR
And bytw
76 replies