Friday, March 1, 2019
no image

New to .NET - Having an issue with codebehind

I am a new vb.net developer (I've coded a lot in Javascript and ASP.NET, but this is a new gig).

I have a dynamic panel that is being built in codebehind, and add the attribute "data-use" and set it to "false".

On the running page, I have a javascript function that runs, and sets that panels "data-use" attribute to "true".

Now, when I debug the codebehind and step through the code, when I look at the panel in the immediate window with

?pnlName.Attributes("data-use") 

I get a return value of false, but while the page is paused, and I bring up the web console (in Chrome Dev Tools) and use jQuery to get the attribute value

$("#panelid").attr("data-use"); 

it returns a true value...

Now I will admit that I'm very new to VB.net (new job) but a) why are these 2 values different, and b) how can I get the codebehind to see this value as true?

New to .NET - Having an issue with codebehind Click here
Read More
no image

Released .NET Testcontainers 0.0.4

Something more than a week ago I started this project and I would like to introduce you to the recent progress. Since then, I've been able to add a lot of features to the project. Currently, Testcontainers supports the basic functionality of Docker and makes complex tests much easier. Following commands are supported:

  • WithImage
  • WithName
  • WithWorkingDirectory
  • WithEntrypoint
  • WithCommand
  • WithEnvironment
  • WithLabel
  • WithExposedPort
  • WithPortBinding
  • WithMount

A detailed description of the functions, as well as use cases, can be found on the source repository. Have also a look into the test class, it contains some examples too. Here's a short one:

```chsarp var target = "tmp";

var file = "dayOfWeek";

var dayOfWeek = DateTime.Now.DayOfWeek.ToString();

var testcontainersBuilder = new TestcontainersBuilder() .WithImage("nginx") .WithMount(".", $"/{target}") .WithEnvironment("dayOfWekk", dayOfWeek) .WithCommand("/bin/bash", "-c", $"printf $dayOfWekk > /{target}/{file}");

using (var testcontainer = testcontainersBuilder.Build()) { await testcontainer.StartAsync(); }

// Text contains dayOfWeek. string text = File.ReadAllText($"./{file}"); ```

Next, I will:

  • Move NuGet beta versions to a different package manager.
    • I like the continuous delivery idea. However, it looks a bit messy - what do you think?
  • Create and update the documentation for the internal classes, methods, and interfaces.
  • Reduce the number of parameters in the constructor of TestcontainersBuilder.
  • Add authentication for private Docker Hubs.
  • Pre-configured test containers.

I'm looking forward to your feedback, I wish you all a nice weekend, stay tuned!

Source repository: https://github.com/HofmeisterAn/dotnet-testcontainers

Released .NET Testcontainers 0.0.4 Click here
Read More
no image

help choosing a CRUD framework

I am writing a (mostly) CRUD desktop app in C#. My first framework choice was EntityFramework, but I found a couple of issues with it. Most significant was that my Entities don't neatly correspond to tables. Because of access control I had to create views. Delete operations on my views aren't allowed in MySQL so there are stored procs for that. Updates and Inserts are allowed. I found that EF6 [which Microsoft recommends not to use for new projects] would have forced me to create stored procs for all operations. EF Core [which they do recommend for new projects] doesn't support stored procs at all. Besides this basic issue, my app will eventually detach from the database and request everything from a server that will query the DB and apply access control in logic. So the framework I'm looking for should assume that data looks like tables, but not necessarily expect to go to the database to get it.

I found that ADO.NET has the general design that fits these requirements. It has a representation of tables and can use custom adapters to fill the data. It does change tracking. But I find that I have to implement a basic things like ListCollectionView subclasses to have more flexible binding to WPF controls, optimistic concurrency support... Also ADO.NET tables aren't strongly typed and setting/getting fields will result in boxing/unboxing. It doesn't feel right.

If you are still reading this, thank you! The question is whether I'm reinventing the wheel here. Is there a framework that will do CRUD with change tracking and be flexible about the back end? I'm ok paying $2K for commercial products like DevExpress if they save me from writing a custom framework.

help choosing a CRUD framework Click here
Read More
no image

Best way to create and host an HTML form with a backend

I've got to create a small registration form for an event. Normally I'd use Google Forms or something similar, but since I rely on being able to add some extra bells and whistles both on the backend and the frontend I need something that I can have more control over.

I have all the coding skills needed and I could make a new .NET MVC project and host that in Azure, but I was hoping for a more lightweight solution.

Does anyone have any good ideas?

Best way to create and host an HTML form with a backend Click here
Read More
no image

How to display data from another table?

Hey guys, imagine i have two tables, employee and company.

the employee has the follow colums: Id , name and company (wich is a foreign key from the table company)

now i created a employee model wich declairs the company column this way: public company company { get; set; }

On the view page i want to list all employees and the name of the company and i use @foreach (var item in Model) to list all employees, when i want to display the company name i would use something like this @Html.DisplayFor(modelItem => item.company.name) but it wont display the name of the company (of course because the code could be something else), can any one help me getting to display the name of the companys ? Thanks!

How to display data from another table? Click here
Read More
The webdev Team