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

MrKBA

@MrKBA
About
Posts
197
Topics
76
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • EF codeFirst generation error
    M MrKBA

    I'm beginner on EntityFramework Core Code first database generation and I have a problem with relation configuration of two entities :

    public class EntityParent
    {
    public int Id { get; set; }
    public string Name { get; set; }
    //Navigation properties to the EntityChildren which have info of start position.
    [ForeignKey("TransformationEntity")]
    public int? TransformationEntityId { get; set; }
    public virtual EntityChildren TransformationEntity { get; set; }
    //Navigation property : List of childrens
    public virtual ICollection Childrens { get; set; }
    }
    public class EntityChildren
    {
    public int Id { get; set; }
    public string Name { get; set; }
    public int StartPosition { get; set; }
    //List of EntityParents which have this EntityChildren as the start position
    public virtual ICollection TransformedParents { get; set; }
    //Relation one-to-one(this same table)
    [ForeignKey("EntityChildrenSource")]
    public int? Cadrage { get; set; }
    public virtual EntityChildren EntityChildrenSource { get; set; }
    public virtual EntityChildren EntityChildrenTarget { get; set; }
    //Navigation property to EntityParent
    [ForeignKey("Parent")]
    public int Parent_FK { get; set; }
    public virtual EntityParent Parent { get; set; }
    }

    The goal is to have in the EntityParent the properties : - List of childrens. - The EntityChildren that contains Start position. And in the EntityChildren the properties : - List of EntityParent which have this entity as start position - The EntityParent of this EntityChildren - The EntityChildrenSource - The EntityChildrenTarget BUT when executing the command to generate scripts of database I have the error bellow : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Unable to det ermine the relationship represented by navigation property 'EntityChildren.TransformedParents' of type 'ICollection'. Either manually configu re the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyMappingValidationConvention.Apply(InternalModelBuilder modelBuilder) at Microsoft.EntityFrameworkCore.Metadata.Conventi

    .NET (Core and Framework) help asp-net database question learning

  • .NET , SQLite to SQLServer Entity Framework migration
    M MrKBA

    Thanks for reply, But what I asked for is using code will be more better than using standard tools ? and if yes how achieve this ? Thank you

    .NET (Core and Framework) database question csharp sqlite help

  • .NET , SQLite to SQLServer Entity Framework migration
    M MrKBA

    Hi, I need help in "how to do it" I have an existing .NET application which use Sql Entity Framework with SQLite databse. This application is deployed and used by client and there is a production database . Now the client need to migrate this database to SQLServer. So what I need is to migrate the SQLite database to SqlServer and make the necessary in code using Entity Framework always. My question please is what is the best practice to accomplish this and steps to follow. Thanks for help

    .NET (Core and Framework) database question csharp sqlite help

  • XSL to get only elements which have no childs
    M MrKBA

    Yes great, thank you.

    XML / XSL xml help question

  • XSL to get only elements which have no childs
    M MrKBA

    Yes thank you it works but how can I keep the root element please ? I means the (

    )

    XML / XSL xml help question

  • XSL to get only elements which have no childs
    M MrKBA

    sorry for the misunderstood , i will move it

    C# xml help question

  • XSL to get only elements which have no childs
    M MrKBA

    Hi, I make my question after some research in web without any clear response to my problem. I have the following XML and I need to apply an XSL transformation to get only nodes which haven't child. Input :

    Expected output :

    XML / XSL xml help question

  • XSL to get only elements which have no childs
    M MrKBA

    Hi, I make my question after some research in web without any clear response to my problem. I have the following XML and I need to apply an XSL transformation to get only nodes which haven't child. Input :

    Expected output :

    C# xml help question

  • Create .NET COM dll as existing C++ COM
    M MrKBA

    But my COM dll is C++ dll and couldn't be registred as you say .

    C# csharp c++ com help

  • Create .NET COM dll as existing C++ COM
    M MrKBA

    thank you for response but can you tell me how extracting tlb from c++ com because tlbExp not works

    C# csharp c++ com help

  • Create .NET COM dll as existing C++ COM
    M MrKBA

    Hi, I have to create .NET COM dll which will be used fro existing client applications. So what I need is : - create interface with SAME NAME AND GUID - create class implementing this interface ann have SAME NAME AND GUID as one in c++ - client should not rebuild or recompiled (save compatibility) Any help please

    C# csharp c++ com help

  • still shown DialogService until error exists in user input and dont press Cancel
    M MrKBA

    Great, saved me :)

    WPF help

  • still shown DialogService until error exists in user input and dont press Cancel
    M MrKBA

    In my MainWindow.xaml (which will validate data after click on OK )

    in MainWindow.cs (the ViewModel related to the MainWindow.xaml)

       \_roleViewModel = new Role\_ViewModel(eTypeOperation);
            var createCommand = new UICommand
            {
                Id = MessageBoxResult.OK,
                Caption = Properties.Resources.CstOk,
                IsCancel = false,
                IsDefault = true,
                Command = new DelegateCommand(CreateRole, CanCreateRole)
            };
    
            var cancelCommand = new UICommand
            {
                Id = MessageBoxResult.Cancel,
                Caption = Properties.Resources.CstCancel,
                IsCancel = true,
                IsDefault = false,
            };
    
            RoleService.ShowDialog(new List { createCommand, cancelCommand},Properties.Resources.CstNewRole, \_roleViewModel);
    

    private void CreateRole()
    {
    _roleViewModel.AcceptChanges();
    if (ValidateData(_roleViewModel.RoleName.Trim()))
    {
    AddRole(_roleViewModel.RoleName, _roleViewModel.RoleDescription);
    }
    }

    private bool CanCreateRole()
    {
    return !string.IsNullOrEmpty(_roleViewModel.RoleName.Trim());
    }

    WPF help

  • still shown DialogService until error exists in user input and dont press Cancel
    M MrKBA

    the code of command is as described in the first question :

    var createCommand = new UICommand
    {
    Id = MessageBoxResult.OK,
    Caption = Properties.Resources.CstOk,
    IsCancel = false,
    IsDefault = true,
    Command = new DelegateCommand(CreateRole, CanCreateRole)
    };

    WPF help

  • still shown DialogService until error exists in user input and dont press Cancel
    M MrKBA

    But this did'nt solve my problem :) because what I need is : - let user enter some data (if no data => the button still disabled related to

    CanCreateRole

    - when there is data click on Button "OK" - if the data are valid against condition we do nothing and the DialogService close (normal behavior) ELSE (data not valid ) we display messagebox and the DialogService is still shown with last data entered.

    WPF help

  • still shown DialogService until error exists in user input and dont press Cancel
    M MrKBA

    Hi, I included DialogService in my Window to call other view which contains User input values What I need is to prevent closing this dialog until input are validated.

    _roleViewModel = new Role_ViewModel(eTypeOperation);
    var createCommand = new UICommand
    {
    Id = MessageBoxResult.OK,
    Caption = Properties.Resources.CstOk,
    IsCancel = false,
    IsDefault = true,
    Command = new DelegateCommand(CreateRole, CanCreateRole)
    };
    var cancelCommand = new UICommand
    {
    Id = MessageBoxResult.Cancel,
    Caption = Properties.Resources.CstCancel,
    IsCancel = true,
    IsDefault = false,
    };
    RoleService.ShowDialog(new List { createCommand, cancelCommand }, Properties.Resources.CstNewRole, _roleViewModel);

    private IDialogService RoleService
    {
    get { return GetService("RoleServiceDialog"); }
    }

    the CanCreateRole control the state of Button "OK" regarding input user But What I need is to : When click OK button , we should check data (user input) if it is ok we return and close the DialogService otherwise we should display messagebox and stay on this DialogService (don't close) until press "Cancel" Thank you

    WPF help

  • Using Pooling or SqlConnection object variable is better ?
    M MrKBA

    thank you for help

    Database database performance question

  • Using Pooling or SqlConnection object variable is better ?
    M MrKBA

    thank you for response but as I said I know what you suggest but I ask what is more safe also for me.

    Database database performance question

  • Using Pooling or SqlConnection object variable is better ?
    M MrKBA

    thank you for response Yes what I did is that every time I need the connection I use it in using block. Also I use pooling always because I'm using the same connection string. so you see this safe ?

    Database database performance question

  • Using Pooling or SqlConnection object variable is better ?
    M MrKBA

    Hi, I need to know which is better for work and performance please : I have to do many operation on database so I am hesitating between : 1. create object "SqlConnection" and let connection opened during service (webservice) works 2. using the instruction below every time I want to do a modification in dtatabase

    using (SqlConnection sqlconnection = GetSqlConnection(connectionString, false))
    {
    sqlconnection.Open();
    .....

    }

    Where

    public static SqlConnection GetSqlConnection(string connectionString, bool disablePooling = true, bool forceMasterDB = false)
    {
    if (disablePooling || forceMasterDB)
    {
    SqlConnectionStringBuilder sqlConnBuilder = new SqlConnectionStringBuilder(connectionString);

                if (disablePooling)
                    sqlConnBuilder.Pooling = false;
    
                if (forceMasterDB)
                    sqlConnBuilder.InitialCatalog = "master";
    
                connectionString = sqlConnBuilder.ConnectionString;
            }
            return new SqlConnection(connectionString);
        }
    

    Thank you

    Database database performance question
  • Login

  • Don't have an account? Register

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