Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Teiko Pirate
    Hi People! Anyone connected to an Always On (HA) Sql Server with EF6?
    Andrii Maksymets
    public class MyEntity
        public MyComplexType MyComplexType { get; set; }
        public string MySerializedComplexType
            get { return Serialize(MyComplexType); }
            set { MyComplexType = Deserialize(value); }
    is the way to put serialization/deserialization via fluent api in OnModelCreating
    Hi.. having heck of a time with a caching issue with EF Core 1.01. How can I force a query on a table to re-read from the DB? I've tried db.xxxx.AsNoTracking() and it is not working.. the data gets updated outside of the same instance and I just want it to re-load.. it's like a report that should just refresh when I want it refreshed.
    Not only that, but even when I do this it still does not refresh!! FromSql("my own sql")
    Hi Paul,
    I have an entity that has n-to-n relations and i want to bulk delete it by query. how to do that with this library. thanks
    Quan Sun
    I am trying the pgsqlrunner branch, found some problems and fixed them. can I contribute?
    Oleg Rakitskiy
    it should be addressed to @pwelter34, because my pgsqlrunner pull request isn't merged yet.
    Quan Sun
    @raol I tried to contact @pwelter34 but get no response. is this project still active?
    Oleg Rakitskiy
    dunno ¯_(ツ)_/¯
    Hello there
    Is someone able to tell me how can I create a relationship with AspNetUserRoles with EF6 code first / migrations? I need a table that relates UserRoles and Company so that a user may have roles in more than one company. Any help would be greatly appreciated
    is this library working with EntityFramework Core?
    This seems to be breaking with Interception, any plans to support interceptors?
    Gary Kaganas
    @raol newb question. Do we need to call ctx.SaveChanges for .Update()/.Delete()?
    Oleg Rakitskiy
    @Seebiscuit nope. All your changes go directly to the DB bypassing EF context.
    Gary Kaganas
    Thanks for that bit, @raol. So, does that mean that the context is not tracking the entity?
    Oleg Rakitskiy
    Yes, you are right. Entities are not loaded into context during update/delete operations.
    Context is used as a metadata provider when query against the database is constructed from Expression<>.
    Gary Kaganas
    So we really should start a new context to get data from a previously tracked entity (which may be stale after an Update)
    hi all
    Hi everyone.
    Have a question rather about plain EntityFramework. When I want to access a set of entities in my context in a generic way - I should do something like:
    but when I apply .Where(...) to the result - it gives me IEnumerable rather than IQueryable
    and when I get set of entities in a regular way: context.MyEntities1 - then when I apply .Where(...) it gives me IQueryable
    so how do I make it work as IQueryable in a generic way?
    So when I do var x = context.Users.Where(...) -- I get IQueryable here
    But when I do var x = context.Set<T>().Where(...) in a generic way having T = User -- I get IEnumerable, but I'd like to get IQueryable. How do I get it?
    Brent Arias
    @intruder777 I'm new to EF and don't know the answer. Wish I could help. :(
    I have my own question. I have several different DTO objects that I want EF to map to a single view. Unfortunately this causes EF to complain entity types cannot share table 'myView' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship.... I suspect this problem assumes that I intend read/write access to the data. Is it possible to solve this problem by telling EF that I want read-only access?
    what is complextypes in EF6.0 and how to use them ?
    Markus Schaber
    Hmm, it seems lots of people (including me) strand here while searching for a general channel for EF or EF Core.
    Any hints where we should go instead?
    Hello! Can't solve the problem with simultaneous access to data. It is necessary to make a change in the balance (row in the account table). If there are two transactions, and both of them must be performed, should I use pessimistic concurrency? But if i set the serializable isolation level then the second transaction will generate an error while saving? (I'm using DbContext.BeginTransaction) Should i execute T-SQL manually?
    Do you use annotations like "Display", "RegularExpression", "Required", "ErrorMessage" when developing entityframework library(separate library project )?
    hi all
    is here anybody ?
    Kouadio Brice Marcel
    Frank Akogun
    Hi guys
    Please can any of you be so kind and help solve a challenge
    the question has been asked on stackoverflow already by me

    Anyone have any luck with the following Data Annotation & asp- helpers on an MVC page

    [Editable(false, AllowInitialValue = true)]
    public string Name { get; set; }

    I was expecting it to allow an initial value to be entered into a field, then be readonly from then on, But it just sets the field readonly always
    Whats it's use case?


    Hi guys, please there is someone who can help me with this problem.
    I want select Advertisements from database by Machine - >Title and District -> Id

    public class Machine
            public Guid Id { get; set; }
            public string Title { get; set; }
            public ICollection<AdvertisementModel> Advertisement { get; set; } = new Collection<AdvertisementModel>();
    public class AdvertisementModel {
       public int Id { get; set; }
       . . . 
       public virtual ICollection<AdvertisementDistrict> AdvertisementDistrict { get; set; } = new Collection<AdvertisementDistrict>();
    public class AdvertisementDistrict
            public int AdvertisementId { get; set; }
            public AdvertisementModel Advertisement { get; set; }
            public int DistrictId { get; set; }
            public District District { get; set; }
    public class District
            public int Id { get; set; }
            public int Code { get; set; }
            . . .
            public virtual ICollection<AdvertisementDistrict> AdvertisementDistrict { get; set; } = new Collection<AdvertisementDistrict>();

    I trying something like

            public async Task<IEnumerable<AdvertisementModel>> GetSpecificAdvertisement(string machineName, int districtId)
                var advertisement = await _context.Advertisements.Where(x => x.Machine.Title == machineName).ToListAsync();
                var result = advertisement.Where(item => item.AdvertisementDistrict.Where(y => y.DistrictId == districtId));
                return result;

    but item.AdvertisementDistrict.Where(y => y.DistrictId == districtId) get error :/
    Help me please. Thanks

    Islam alshiki
    My website localy works good, when i upload it using FTP on Godaddy host some error is happening when i do any action that makes any connection to databases. Could not load file or assemply 'EntityFramework, Version=, Culture=nerural ...etc. BadImageFormatExaption
    Hi, I hope this is the right place... I have a Stack Overflow question
    I'm going to be offline for a bit but I'll be back in a few hours