Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

Ciumac Sergiu

@Ciumac Sergiu
About
Posts
18
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • IQueryable or IEnumerable as returns from Repositories
    C Ciumac Sergiu

    Hi all, Repository[^] pattern with Unit of Work[^] and Dependency Injection, seem to be a universaly accepted solution for ASP.NET + EF applications. There are still some minor questions that I would like to ask here. Consider the following method from a generic IRepository interface:

    public IQueryable Get() where T : class
    {
    return Set();
    }

    I wonder, is it a good practice in reveling IQueryable interface to the callers. This means that the calling method can add filters/paggin/sorting, but at the same time the repository itself becomes not unit testable (you cant rely anymore on what the repository will actually return). The caller can even add a non-translatable predicate that will break at runtime. So, is it a good practice in hiding IQueryable interface from the caller, and defining IEnumerable interface instead? Also, I wonder how do you perform integration tests on repositories? Do you use SQL CE4, full SQL Server, or just Fake objects on DbContext? Appreciate your response, With regards

    C# csharp html asp-net database sql-server

  • Object naming convention
    C Ciumac Sergiu

    Good point.

    C# question

  • Object naming convention
    C Ciumac Sergiu

    Cool stuff, like the sourceObject solution. Though, just source sounds even better.

    C# question

  • Object naming convention
    C Ciumac Sergiu

    Thanks for suggestion, I was always tempted to append "to". In that case it would be toEncrypt. But it scratches my ear badly. I really like encrypt but its a verb, and it breaks the convention a little. As for your CommandDoSomething.DoSomething example. I might have misunderstood you, but I prefer not appending action name to class name or viceversa:

    //prefer
    User client = User.Create();
    //instead of
    User client = User.CreateUser();

    Anyway, I believe its a matter of preference :) Regards

    C# question

  • Object naming convention
    C Ciumac Sergiu

    Hi guys, The question is of pure interest: how do you prefer naming a variable/parameter of type Object? Most of the time it depends upon the logic of its usage, but not always. Sometimes you just want to express a generic entity:

    public byte[] Encrypt(Object x)
    public byte[] Serialize(Object o)

    Its tempting to name x as obj or objToEncrypt, but it sounds more like a Hungarian notation. So how would you consider naming it?

    C# question

  • MVP
    C Ciumac Sergiu

    Congratulations Nick!

    The Lounge architecture

  • 2012 MVPs announced...
    C Ciumac Sergiu

    Congrats Nish!

    The Lounge php com tools

  • how to make money ?
    C Ciumac Sergiu

    At your age I would rather look for knowledge than money. Anyway, you might try finding a job at www.odesk.com, or try your skills at any programming competitions (Google Code Jam, Top Coder, etc.).

    The Lounge csharp learning com help

  • Cost of living
    C Ciumac Sergiu

    Good remark.

    The Lounge com tools tutorial

  • Resigning from job ...
    C Ciumac Sergiu

    Yeap, its like

    private string resign(){
    //return "Burn in Hell!"
    return "Best wishes!"
    }

    :)

    The Lounge question career

  • Resigning from job ...
    C Ciumac Sergiu

    Everybody that leaves our office sends a corporate email to all employees, with a last "thank you" :)

    The Lounge question career

  • How to create a memory mapped file in a service?
    C Ciumac Sergiu

    You need to create an inter-process memory map file with MemoryMappedFile.CreateNew method. In this way you'll be able to access it from different processes.

    C# xml performance help tutorial question

  • Not null check
    C Ciumac Sergiu

    This one would be even more subtle :cool:

    if ( !( !( !( !(a==null) == true ) == false ) == true)) {...}

    The Weird and The Wonderful announcement

  • Not null check
    C Ciumac Sergiu

    Related to the above: flag = bool(int(flag) - 1);

    The Weird and The Wonderful announcement

  • Not null check
    C Ciumac Sergiu

    How about this piece of code: if (a == null == false) { } Spent some time before figuring out it is a version of if (а != null) {}

    The Weird and The Wonderful announcement

  • sql database
    C Ciumac Sergiu

    Check this. It might be helpful http://urenjoy.blogspot.com/2009/08/database-installation-vs-setup-custom.html[^]

    .NET (Core and Framework) database

  • Troubles with a DPI Aware application
    C Ciumac Sergiu

    Try to set AutoScaleMode of the form to NONE. Not sure if it helps, but there is a good article related to scaling http://en.csharp-online.net/Layout[^]

    C# question

  • How to refresh Database Connections
    C Ciumac Sergiu

    All in all, you have Delete, Insert, Update in a class, so you can declare an Event (Modified), and subscribe to it. When it fires, call setRecords sub. In C# it looks as follows:

    public event EventHandler DatabaseDataModified;

    protected virtual void OnDatabaseDataModified(EventArgs args)
    {
    if(DatabaseDataModified != null)
    DatabaseDataModified.Invoke(this, args);
    }

    Call OnDatabaseDataModified method everytime a record is updated in the database. Subscribe to DatabaseDataModified event and call setRecords sub, once the event handler fires. For a more detailed review check publish/subscribe model.

    .NET (Core and Framework) database help tutorial question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups