Questions tagged [c#]

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.

484 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
722 views

Xamarin Forms MVVM Light Toolkit usage

I am playing around with Xamarin, because there is a good chance that I might have to start a project using it in a few months. What I am mostly looking at is Xamarin Forms as I am familiar with WPF ...
1
vote
0answers
69 views

Query against history table

I have this linq query that queries a table that retains any change history done to any of the tables is constructed like this: ...
1
vote
0answers
1k views

Azure Active Directory controller

I have a class called AzureActiveDirectoryController. This class has some methods: one to create users, one to get the app name, one to register schema extensions (...
1
vote
0answers
431 views

Porting Delphi typed arrays to .NET generics

Currently I am porting piece of code from some old Delphi API to C# and smashed into weirdness of type definitions. As its schema fits perfectly with DLL it uses (because it also was made in Delphi ...
1
vote
0answers
2k views

Rx.net File watcher

I am new with Rx.net and tried to do a folder watcher that could send a notification when a new file is done being uploaded. Each instance check one and only one folder. Here are the steps to achieve ...
1
vote
0answers
867 views

Repository pattern with data access objects

I started a new ASP.NET project in an effort to better learn SQL and Dapper ORM framework. My idea for data access: Have POCO entities, for each entity have DAO object. When I want to manipulate with ...
1
vote
0answers
69 views

Persisting database row ID between controller actions on a multi-step “create item” form

I have a form on an anonymous site which has 3 steps. A user submits each step individually, in sequence (1-2-3). BUT, step 1 creates a new table row, while steps 2 and 3 only update the existing row (...
1
vote
0answers
332 views

Entity Framework 6.0.2 - Performance of Auditable Change Tracking Part 2 of 2

This is Part 2 of a question about performance and general best practices. Part 1 is located here. The body of the messages are the same to illustrate their similarity, the difference is the code ...
1
vote
0answers
2k views

DataTable 'adapter' to HTML table generator

This is a project I am working on, which generates an HTML table out of a query result. (The result DataTable of an SQL command via SP) This section of the ...
0
votes
0answers
21 views

C# + Linq - grouping objects by frames of time found in the data

A bit of background. In the application I work on there are emails sent to notify users about articles they need to review. Each email+recipient pair is stored in database and may be assigned a ...
0
votes
0answers
9 views

Chart.js - Getting data from database using sql server and asp.net mvc5

I displayed and styled the chart.js and am also using mock data in the array, I just can't get my head around how to populate the data in the chart.js using MVC 5. I have tried lots of different ...
0
votes
0answers
66 views

Cancel Long Running Query using Cancellation Token AND SqlCommand.Cancel()

I need to be able to cancel a long running query programmatically through our application. The code below will kick off a long running query and give control back to the main thread. At any ...
0
votes
0answers
57 views

GCD Groups with list

We have a list. divide the list element into two groups such that when the product of the numbers of two groups is taken and their GCD is calculated, it came out to be 1. Answer the number of ways in ...
0
votes
0answers
36 views

Stream wrapper for base 64 string

We have a scenario where we are receiving file as base64 string. This is not ideal and should be a binary stream. Because with file size memory utilization grows very rapidly as base64 representation ...
0
votes
0answers
89 views

Bank ATM App Mockup - Implementing Domain-Driven Design (DDD)

There is a follow-up on this question. I have created this bank ATM app mockup which I believe implement some Domain-Design Design layered architecture, repository pattern and uow pattern, if not ...
0
votes
0answers
43 views

Entity Framework C# updating an entity list generic solution

I have an entity which has a list of other entities in it. for example: class Library { public virtual List<Book> Books{get;set;} } And I would like to ...
0
votes
0answers
31 views

Business logic refactoring needed

I am using asp.net web API and EF code first. I am querying the database based on values inside of the request object (initiate). If there are results, I am updating the database. Then I am querying ...
0
votes
0answers
108 views

JWT generation/validation

In my asp.net web API rest application, I am using JWT generation and validation as follows. Would you please check my sample code? If I make it expire let's say after a day, what might be the costs? ...
0
votes
0answers
45 views

Using System.Security.Cryptography.Aes to generate encryption key

Is the below method a safe way of generating a random encryption key to be used with AES (SymmetricAlgorithm) in .NET? It essentially piggybacks off of the Aes alg to create a random key, trimmed to ...
0
votes
0answers
34 views

TicTacToe Board Check

I have written a code in C# that checks whether the user have won the TicTacToe game. I feel that maybe there is a more elegant way to check it, but I couldn't find one. Would like your help. ...
0
votes
0answers
232 views

.NET core controller method to populate jQuery datatable of users and roles

I want to know whether I am following the best practices of using jquery datatable with .net core. In Controller ...
0
votes
0answers
1k views

Using RabbitMQ in asp.net web api

Use case : I have a Order web Api which creates an orders and publish the order to messaging queue. Notification service (web api 2) consumes this message by subscribing to the messaging queue and ...
0
votes
0answers
896 views

Bank ATM in C# Console Project

Sort of completed my bank ATM in C# console project. What do you guys think of the structure/design of this whole solution? There are 2 console projects ( Bank Admin and Bank Customer) and the third ...
0
votes
0answers
127 views

HttpListener Server for building reports in Excel

I have coded a web-based Excel file builder and sender, that serves the file over Http(example links in code). I would like to see improvements and any suggestions you might have. ...
0
votes
0answers
120 views

Using an N-Tier architecture for a dynamic CRUD user control system

I want to design a flexible dynamic system for a client with standard data-entry screens and CRUD UserControls I dont know whether ...
0
votes
0answers
395 views

Upsert with .Net Core Web API

I am using .NET Core 2.2, EF Core and C#. I have created a web API project. I was requested to do an Upsert (insert or update). The entities structure is: Movie User Rating: this is used to give a ...
0
votes
0answers
65 views

Created Insert Update Delete Application on a single page on MVC

I have created an Application on MVC which makes Select, Insert, Update and Delete on a single page and I need to make it optimised. I have created 2 partial pages, one for grid and another to submit ...
0
votes
0answers
50 views

Loading data via Excel to SQL

I am loading data from a excel file to sql, I added comments to the code to further clarify what each lines purpose is. ...
0
votes
0answers
62 views

Inject settings as a dependency, and serve them using a Web API

I used an opportunity to learn about Dependency Injection and DDD, therefore, althought any feedback is welcome, I am interested in feedback about those software design principles. I have a small ...
0
votes
0answers
200 views

DataTable extension methods and proper disposing of unneeded resources

I've build two extension methods, that allows me to show DataTable inside window. Below is my code: ...
-1
votes
1answer
1k views

Ado.Net and Async insert of many rows to db

I have implemented repository in Ado.Net which insert data to many tables. I insert all in one transaction and use async/await to improve performances. If you have any suggestions have to improve my ...
-1
votes
1answer
3k views

ASP.NET MVC multi language website

What is the best way to make an ASP.NET MVC multi language website? The following code is what I use, but I need to make sure from your real-world experience that my code is the best way for ...
-2
votes
0answers
37 views

Re-fetching revoked OAuth token

I am trying to handle the case if a OAuth V1 token is expired or revoked and has to be re-fetched and wonder if I'm doing it right. ...
-4
votes
0answers
49 views

Promise Library

I have a C# Promise implementation (based off Promises/A+ and ES6 with some alterations to support cancelations and normalized progress). It is fully functional in a single-threaded environment. ...