Can I stop the dbml designer from adding a connection string to the dbml file? [duplicate]

While in the designer for the DBML, you can right-click on any white-space, and click on Properties (not the same as right-clicking on the DBML file and clicking Properties). From there, expand the “Connection” option. Set “Application Settings” to False and clear out the “Connection String” setting. These settings are what the designer uses to … Read more

Unable to create an object of type ‘MyContext’. For the different patterns supported at design time

I Resolved this by just adding a plain constructor to my Context public class DataContext : DbContext { public DataContext() { } public DataContext(DbContextOptions options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder options) { if (!options.IsConfigured) { options.UseSqlServer(“A FALLBACK CONNECTION STRING”); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } }

Why are DataContext and ItemsSource not redundant?

DataContext is just a handy way to pick up a context for bindings for the cases where an explicit source isn’t specified. It is inherited, which makes it possible to do this: <StackPanel DataContext=”{StaticResource Data}”> <ListBox ItemsSource=”{Binding Customers}”/> <ListBox ItemsSource=”{Binding Orders}”/> </StackPanel> Here, Customers and Orders are collections on the resource called “Data”. In your … Read more

WPF ContextMenu woes: How do I set the DataContext of the ContextMenu?

The ContextMenu is outside of the visual tree. Below is the xaml that should get you the datacontext: <ItemsControl ItemsSource=”{Binding Markers}” Tag=”{Binding ElementName=outerControl, Path=DataContext}”> … <ContextMenu DataContext=”{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}”> <MenuItem Header=”Edit” Command=”{Binding EditCommand}” /> </ContextMenu> … </ItemsControl> This post explains how this works.

Should I return IEnumerable or IQueryable from my DAL?

It depends on what behavior you want. Returning an IList<T> tells the caller that they’ve received all of the data they’ve requested Returning an IEnumerable<T> tells the caller that they’ll need to iterate over the result and it might be lazily loaded. Returning an IQueryable<T> tells the caller that the result is backed by a … Read more

Setting a custom property within a WPF/Silverlight page

You can work with normal property without Dependency property if you create a Base class for your Page. public class BaseWindow : Window { public string MyProperty { get; set; } } <local:BaseWindow x:Class=”BaseWindowSample.Window1″ x:Name=”winImp” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:local=”clr-namespace:BaseWindowSample” MyProperty=”myproperty value” Title=”Window1″ Height=”300″ Width=”300″> </local:BaseWindow> And it works even though MyProperty is not a Dependency or … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)