Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time only portion of the date to use in LINQ query
Message
 
 
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01622912
Message ID:
01623309
Views:
92
>>>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
>>  }
>>
>
>So what is the Type on _siriusContext ?
namespace SysManager.Repository
{
    public abstract class RepositoryBaseWithList<T, TList> : IRepositoryWithList<T, TList> 
    where T : class where TList: class
    {
        protected readonly ISiriusSqlContext _siriusContext;

        protected readonly IDbSet<T> _dbSet;
        protected readonly IDbSet<TList> _dbSetList;
        private readonly IExceptionParser _exceptionParser;
etc.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform