Skip to content

Instantly share code, notes, and snippets.

View carloswm85's full-sized avatar
🎯
Compiling...

Carlos W. Mercado carloswm85

🎯
Compiling...
View GitHub Profile
Checking project for required NuGet packges...
Downloading service reference from http://localhost/WebApiMining/api/...
ErrorFailed adding service reference(s). Failed to download metadata file from : http://localhost/WebApiMining/api/.
Checking project for required NuGet packges...
Downloading service reference from http://localhost/WebApiMining/...
Adding service reference to the project...
Generating code to .cs...
ErrorFailed adding service reference(s). Code generation for file NSwag.exe failed.
Command line: openapi2csclient /input:"C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Web\OpenAPIs\.json" /classname:defg /namespace:abce /output:"C:\Users\carlo\source\repos\guiaminera\MiningGuide\MiningGuide.Web\OpenAPIs\.cs"
Output: NSwag command line tool for .NET 4.6.1+ WinX64, toolchain v13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v11.0.0.0))
@carloswm85
carloswm85 / ShareX-Log-2022-09.txt
Created February 26, 2023 03:26
Sharex log for issue...
2022-09-22 17:23:53.355 - ShareX starting.
2022-09-22 17:23:53.358 - Version: 14.1
2022-09-22 17:23:53.358 - Build: Release
2022-09-22 17:23:53.358 - Command line: "C:\Program Files\ShareX\ShareX.exe"
2022-09-22 17:23:53.358 - Personal path: G:\My Drive\_bin_cwm\_sharex_settings
2022-09-22 17:23:53.358 - Personal path detection method: PersonalPath.cfg file (C:\Users\cwm\OneDrive\Documentos\ShareX\PersonalPath.cfg)
2022-09-22 17:23:53.358 - Operating system: Windows 10 Education (64-bit)
2022-09-22 17:23:53.358 - Running as elevated process: False
2022-09-22 17:23:53.467 - ApplicationConfig file does not exist: G:\My Drive\_bin_cwm\_sharex_settings\ApplicationConfig.json
2022-09-22 17:23:53.467 - ApplicationConfig file does not exist: G:\My Drive\_bin_cwm\_sharex_settings\ApplicationConfig.json.temp
@carloswm85
carloswm85 / SeedData.cs
Created March 4, 2023 14:28
Seed data to database with Bogus.
using MegaDeskRazorPages.Data;
using Microsoft.EntityFrameworkCore;
using MegaDeskRazorPages.Models;
using MegaDeskRazorPages.Utilities;
using Bogus;
namespace MyScriptureJournal.Models;
public static class SeedData
{

Microsoft Visual Studio Community 2022 Version 17.5.3 VisualStudio.17.Release/17.5.3+33516.290 Microsoft .NET Framework Version 4.8.04161

Installed Version: Community

Visual C++ 2022 00482-90000-00000-AA235 Microsoft Visual C++ 2022

<!-- OLD FILE -->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<ActiveDebugFramework>net6.0-windows10.0.19041.0</ActiveDebugFramework>
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
<DefaultDevice>pixel_5_-_api_31</DefaultDevice>
</PropertyGroup>
// https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html#translation
$('.gdefile-mask').mask('FILE-0000-00000000-MTCA-PRODUCTION-#SEMSECTOR', {
'translation': {
'A': { pattern: /A/, fallback: 'A', optional: false },
'#': { pattern: /#/, fallback: '#', optional: false },
'S': { pattern: /S/, fallback: 'S', optional: false }
},
placeholder: "FILE-____-________-MTCA-PRODUCTION-#SEMSECTOR"
});
@carloswm85
carloswm85 / SelectList.cs
Created April 20, 2023 16:56
How do I add Title to this SelectList? Or any other data-* HTML attribute?
public IEnumerable<SelectListItem> GetProducersSelectList()
{
SelectList selectList = new SelectList(
ProducersList
.Select(
producer =>
new
{
Text = producer.ProducerNumber + " • " + producer.Surname + ", " + producer.Name,
Value = producer.Id.ToString(),
@carloswm85
carloswm85 / GetNextExpirationDate.cs
Last active May 2, 2023 17:27
GetNextExpirationDate
public DateTime? GetNextExpirationDate()
{
DateTime year = new DateTime(DateTime.Now.Year, 1, 1);
DateTime today = DateTime.Now;
IQueryable<ConfiguracionWeb> dates = _unitOfWork.WebConfigurationRepository.GetAll();
DateTime firstDate = DateTime
.Parse(dates
.First(u => (WebConfigEnumerations)u.enumeracion == WebConfigEnumerations.PrimerVencimiento)
@carloswm85
carloswm85 / Product.cs
Created May 16, 2023 11:51
Example of a model class using C# based on domain-driven design principles, including attributes and behaviors.
public class Product
{
// The attributes have private setters, meaning they can only be modified from within the class itself.
public int Id { get; private set; }
public string Name { get; private set; }
public decimal Price { get; private set; }
public DateTime CreatedAt { get; private set; }
public DateTime? UpdatedAt { get; private set; }
public Product(string name, decimal price)
@carloswm85
carloswm85 / Running-transformation-NullReferenceException.md
Last active June 1, 2023 13:00
Running transformation: System.NullReferenceException: Object reference not set to an instance of an object. Possible solution.

The problem seems to be related to Visual Studio 2022 versions higher than 17.5.5

See the problem at: https://developercommunity.visualstudio.com/t/Cannot-import-anymore-tables-into-edmx/10368835 or https://developercommunity.visualstudio.com/t/Create-or-recreate-a-Model-does-not-work/10318478

Solutions:

The problem: