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
M

Mohammad Dayyan

@Mohammad Dayyan
About
Posts
1.2k
Topics
379
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ?
    M Mohammad Dayyan

    Thanks

    C# csharp regex tutorial question

  • Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ?
    M Mohammad Dayyan

    Well :^) there are some reasons that you could find them with Google.

    Eddy Vluggen wrote:

    What do you think you will gain from the added patterns that's not there in EF?

    my reasons : With Repository pattern we could hide DbContext(or ObjectContext) in UI layer for UI programmers and the they don't need to work with DbContext directly. otherwise, for each entity we have to write Update, Delete, Insert, ... methods. So with repository "Don't Repeat Yourself"

    Eddy Vluggen wrote:

    And why do you want a singleton, and not a simple static class?

    Static class is an instance for all, and it has the same position in RAM of system. but Singleton has a static field and we can have different instances of our class, but we prevent coupling

    C# csharp regex tutorial question

  • Is it OK to implement Repository Pattern with Singleton in C# and EntityFramework ?
    M Mohammad Dayyan

    As you know, in Entity Framework Repository Pattern we have new DbContext(or object context) in each entity's instance. Is it OK to implement Repository Pattern with Singleton to have the same DbContext in each entity's instance? If so, could you please post some references ? Thanks Read more about Repository Pattern : http://www.remondo.net/repository-pattern-example-csharp/[^]

    C# csharp regex tutorial question

  • Expire Sessions via Session Id in ASP.Net C#?
    M Mohammad Dayyan

    Well, Because I guess, it couldn't done in ASP.Net, I've written it in C# forum. AFAIK Session.Abandon(); expire current session ! I wanna expire a session with session id

    C# csharp question asp-net data-structures

  • Expire Sessions via Session Id in ASP.Net C#?
    M Mohammad Dayyan

    I have an array includes list of users session id. I wanna expire all of them. Is it possible in ASP.Net (c#), if so, how ? else, how can I do it with C#? Thanks in advanced

    C# csharp question asp-net data-structures

  • Happy New Persian Year ;)
    M Mohammad Dayyan

    Wow, do you now Persian?

    The Lounge

  • Happy New Persian Year ;)
    M Mohammad Dayyan

    Well, I haven't hear that so far ;P

    The Lounge

  • Happy New Persian Year ;)
    M Mohammad Dayyan

    Wow, New car ? Why new car !

    The Lounge

  • Happy New Persian Year ;)
    M Mohammad Dayyan

    Hi friends from all of the world, Today is the first day of 1391 persian year. Happy New Year :rose: In an old traditional ceremony, each Iranian family make an tablecloth that contains 7 God blessings that started with Seen(س). each of them is symbol of some God blessings : Apple(Sib), Vinegar(Serke), Sea-buckthorn(Senjed), Coin as plenty(Sekke), Verdure(Sabze), Clock as life(Sa-at), Samano(kind of dish prepared from the juice of germinating wheat) Read more about Haft-Seen[^]

    The Lounge

  • What's your Recommendation?
    M Mohammad Dayyan

    well, it's easier to carry 2kg against to carry 3,4,...kg

    The Lounge csharp asp-net tutorial question

  • What's your Recommendation?
    M Mohammad Dayyan

    Because, I need a portable laptop :)

    The Lounge csharp asp-net tutorial question

  • What's your Recommendation?
    M Mohammad Dayyan

    Do you have a specific model in mind ?

    The Lounge csharp asp-net tutorial question

  • What's your Recommendation?
    M Mohammad Dayyan

    I'm gonna buy a Laptop with weight lower than 2KG for ASP.Net programming. I prefer ASUS , because of my friends recommendations. Whats your recommendation ? :confused: It would be appreciate if you guide me to determine an specific model.

    The Lounge csharp asp-net tutorial question

  • SQL Backing up with SMO & C# ?
    M Mohammad Dayyan

    Ravi Bhavnani wrote:

    Is the version of .NET on the XP system the same as that on your Win7 system?

    The version that I've created the code based on was 9 but the version of destination system is 10, I created the project with 10 version but I receive below Exception :

    Restore failed for Server '\\\\.\\pipe\\3F103E6E-3FD4-47\\tsql\\query'.

    :(

    C# database help question csharp com

  • {"Restore failed for Server '\\\\.\\pipe\\3F103E6E-3FD4-47\\tsql\\query'. "}
    M Mohammad Dayyan

    Hi guys, I'm using the following code to restore a backup sql database with C# and SMO.

    void RestoreDatabaseWithSMO(string sConnect, string dbName, string backUpPath)
    {
    using (SqlConnection cnn = new SqlConnection(sConnect))
    {
    cnn.Open();
    cnn.ChangeDatabase("master");

        ServerConnection sc = new ServerConnection(cnn);
        Server sv = new Server(sc);
    
        if (!sv.Databases.Contains(dbName))
            throw new Exception("this DataBase does not exist");
    
        // Create backup device item for the backup
        BackupDeviceItem bdi = new BackupDeviceItem(backUpPath, DeviceType.File);
    
        // Create the restore object
        Restore resDB = new Restore();
        resDB.PercentComplete += new PercentCompleteEventHandler(percentComplete);
        resDB.PercentCompleteNotification = 10;
        resDB.Devices.Add(bdi);
        resDB.NoRecovery = false;
        resDB.ReplaceDatabase = true;
        resDB.Database = dbName;
        resDB.Action = RestoreActionType.Database;
    
        // Restore the database
        resDB.SqlRestore(sv);//Exception
    }
    

    }

    but in the last line I got below exception !!!

    {"Restore failed for Server '\\\\.\\pipe\\3F103E6E-3FD4-47\\tsql\\query'. "}

    What's wrong with it ? Could you please guide me? Thanks

    C# database csharp sql-server sysadmin tutorial

  • SQL Backing up with SMO & C# ?
    M Mohammad Dayyan

    I'm using the following code to back up a SQL Database :

    void BackupDatabase(string sConnect, string dbName, string backUpPath)
    {
    using (SqlConnection cnn = new SqlConnection(sConnect))
    {
    cnn.Open();
    dbName = cnn.Database.ToString();

        ServerConnection sc = new ServerConnection(cnn);
        Server sv = new Server(sc);
    
        // Create backup device item for the backup
        BackupDeviceItem bdi = new BackupDeviceItem(backUpPath, DeviceType.File);
    
        // Create the backup informaton
        Microsoft.SqlServer.Management.Smo.Backup bk = new Backup();
        bk.PercentComplete += new PercentCompleteEventHandler(percentComplete);
        bk.Devices.Add(bdi);
        bk.Action = BackupActionType.Database;
        bk.PercentCompleteNotification = 1;
        bk.BackupSetDescription = dbName;
        bk.BackupSetName = dbName;
        bk.Database = dbName;
        //bk.ExpirationDate = DateTime.Now.AddDays(30);
        bk.LogTruncation = BackupTruncateLogType.Truncate;
        bk.FormatMedia = false;
        bk.Initialize = true;
        bk.Checksum = true;
        bk.ContinueAfterError = true;
        bk.Incremental = false;
    
        // Run the backup
        bk.SqlBackup(sv);
    }
    

    }

    In my system (Win7 x64) it works fine but in destination system (WinXP SP3 x86) I receive the below error : Exception[^] How can I fix it ? Thanks. BTW: I installed SQL Express 2008 R2 in destination system.

    C# database help question csharp com

  • DDL or CLR Trigger sample ?
    M Mohammad Dayyan

    Hi guys, I have a Table (TableTest) in a Database (database1) in SQLExpress 2008. I wanna to call a method in C# whenever something is inserted in the Table. Could you please guide me? It would be great if you post a sample code. Thanks.

    C# database csharp dotnet tutorial question

  • Showing an external image in Expression Blend or Visual Studio ?
    M Mohammad Dayyan

    I have an image lock.png beside of my WPF exe file in the images folder. Now, I'm gonna load it into the WPF Project as an image. I've used the following XAML code:

    <Image Stretch="Fill" Source="pack://siteoforigin:,,,/images/lock.png" />

    It works, but Expression Blend or Visual Studio doesn't show it when I'm working on the project. How can we show external images in these situations?

    WPF csharp wpf visual-studio question

  • Loading an external image to WPF App ?
    M Mohammad Dayyan

    Hi, I have an image lock.png beside of my WPF exe in the images folder. Now, I'm gonna load it into the WPF Project as the App's icon, I've use the following XAML code, but it doesn't work :

    Icon="images\lock.png"

    How should I load an external image into a WPF application? Thanks

    WPF wpf csharp question

  • Is this code Horror ?
    M Mohammad Dayyan

    Thanks a lot.

    C# csharp com help 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