set MyKey="My key from Environment"
set Position__Title=Environment_Editor
set Position__Name=Environment_Rick
dotnet run
// из public class Startup
public void ConfigureServices(IServiceCollection services)
{
services. Configure<PositionOptions>(Configuration.GetSection(
PositionOptions.Position));
services.AddRazorPages();
}
// из кода, который обращается к настройкам
public class PositionOptions
{
public const string Position = "Position";
public string Title { get; set; }
public string Name { get; set; }
}
public Test2Model(IOptions<PositionOptions> options)
{
_options = options.Value;
}
public ContentResult OnGet()
{
return Content($"Title: {_options.Title} \n" +
$"Name: {_options. Name}");
}
var title = Configuration["Position:Title"];
var name = Configuration["Position:Name"];
var query = _dbContext.Products.AsQueryable();
if (request.ProductGroups?.Length > 0)
{
query = query.Where(x => request.ProductGroups.Any(y => y == x.ProductGroup));
}
if (request.SupplierIds?.Length > 0)
{
query = query.Where(x => request.SupplierIds.Any(y => y == x.SupplierId));
}
if (request.Categories?.Length > 0)
{
query = query.Where(x => request.Categories.Any( y => y == x.Category));
}
return Task.FromResult(_mapper.ProjectTo<ProductDto>(query));
void change(string first, string second, string third)
{
if(label1 == null)
{
label1 = new Label();
groupBox1.Controls.Add(label1);
}
label1.Text = questions[current];
}
private Label label1 = null;
xsd SourceFormat.xsd /c /n:NameSpace /o:tmp
cd tmp
ren SourceFormat.cs SourceFormat.designer.cs
move /y SourceFormat.designer.cs ..
cd ..
rd /s/q tmp
var serializer = new XmlSerializer ( typeof ( nmaprun ) );
using ( var writer = new StreamWriter ( xmlFileName ) ) )
{
serializer.Serialize ( writer, item );
writer.Close ();
}
using ( var temp = new StringReader ( xmlText ) )
{
var tmp = serializer.Deserialize ( temp );
return ( nmaprun ) tmp;
}