Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Time only portion of the date to use in LINQ query
Message
 
 
À
13/08/2015 11:40:06
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01622912
Message ID:
01623303
Vues:
93
>AFAIK, if the query is executed against an instance of System.Data.Linq.DataContext linq will use Linq to Sql ; if against System.Data.Objects.ObjectContext then it will use Linq to Entities....

In our case it's an interface based on another interface class which is defined as
 public interface IContext : IDisposable
    {
        IDbSet<T> Set<T>() where T : class;
        int SaveChanges();
        void SetModified(object entity);
        void SetAdd(object entity);
        void SetDeleted(object entity);
        void ExecuteSqlCommand(string sql);
        EntityState GetEntityState(object entity);
        bool IsLoaded(object entity, string navigationPropertyName);
        void Load(object entity, string navigationPropertyName);
        DbPropertyValues GetOriginalValues(object entity);
        DbPropertyValues GetCurrentValues(object entity);
        void EnsurePaddedPrimaryKey<T>(T entity) where T : class;
        ObjectContext CoreContext { get; }
    }
And the code in the method is
var query = this._siriusContext.Max4Sale.Where(m4s => m4s.Type == max4sale.Type);
_siriusContext is an instance of this
 public interface ISiriusSqlContext : IContext
    {
        IDbSet<AccActv> AccActv { get; set; } // acc_actv
        IDbSet<Access> Access { get; set; } // access
       etc. for all other tables/views
  }
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform