Base solution for your next web application

Activities of "drblakl"

Using EF6

And yes, I've used the GetAllIncluding() which works great!

I'm wondering if it's possible to ensure eager loading of specific children always. Within the repository, or database configuration instead of within the app service or other layers.

Hey all, in case anyone needs, also for checking of best practices I did the following:

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
    public class TestAttribute : ActionFilterAttribute, ITransientDependency
    {
        private ITestAppService _iTestAppService;
        private IAbpSession _session;

        public TestAttribute() : this(IocManager.Instance.Resolve<ITestAppService>(), IocManager.Instance.Resolve<IAbpSession>())
        {
        }

        public TestAttribute(ITestAppService service, IAbpSession session)
        {
            _iTestAppService = service;
            _session = session;
        }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.Controller.GetType() == typeof(SpecificController))
            {
                if (_iTestAppService.GetTestItemByUserId(_session.UserId.Value).TestListCheck.Count == 0)
                {
                    filterContext.Result = new RedirectResult("RedirectToSpecificPage");
                }
                base.OnActionExecuting(filterContext);
            }
        }
    }

I added this Attribute Class to a Filters directory within the area it's being used.

Then just added the attribute to the actions where restriction was required.

Please advise if there's a better practice way of achieving the same result.

Thank you!

Hey alper, thanks for the reply, we're using Asp.Net MVC 5 not Core.

Can you please explain or provide an example for Asp.Net MVC 5?

Thank you!

Thanks for the response! I was actually referring more toward the database schema rather than the data if that makes sense. For example, if someone goes in and changes a column, or relationship on the database side, is there a way to detect that within entityframework codefirst to know that the database schema is out of sync with the code base?

Thank you so much! Worked like a charm!

Through messing with my entities the database and entities were not in sync. Just removed them from dbcontext, and added them back as mentioned above and it works great! Thanks again!

Is there a way to determine if the database is out of sync with the entities, for example if the database has been manually modified outside of the code?

The ideal scenario would be:

Use the ADO.NET Visual Editor / Designer to access tables. This would allow us to easily track changes within the database simply by updating the model from the database.

If we created a new repository would we be able to use Multitenancy and features that are available by using Asp.Net Zero?

Could we ensure multitenancy? If so, how so?

Would we have the same control over these entities we would as if we had created them using the Code First Method?

That's the main thing, I don't want to use the ADO.NET Entity Data Model and lose mass amounts of functionality.

Showing 1 to 6 of 6 entries