小编Bas*_*maa的帖子

在实体框架中我想只包括第一个子对象而不包括子对象(sub子)

我有这两个类:

public class BusinessesTBL
{
    public string ID { get; set; }
    public string FirstName { get; set; }
    public string lastName { get; set; }

    public ICollection<OffersTBL> OffersTBLs { get; set; }
}

public class OffersTBL 
{
    public int ID { get; set; }
    public string Name { get; set; }

    public int CatId { get; set; }

    public string BusinessesTBLID { get; set; }
    public virtual BusinessesTBL BusinessesTBLs { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试根据CatId字段提供所有优惠时,我还需要返回BusinessesTBLs,但该方法还会根据每个BusinessesTBL obj返回优惠,我的代码是:

public IQueryable<OffersTBL> GetOffersTBLsCat(int …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc linq-to-entities entity-framework entity-framework-4 entity-framework-5

20
推荐指数
2
解决办法
2813
查看次数

我的Windows Phone应用获取空响应(404 Not Found)第二次,第一次工作很棒;如果没有SSL,总是工作正常

我正在构建我的第一个windowsPhone 8.1应用程序,我的应用程序的作用是创建与服务器的连接以从中获取信息,所以我编写代码来执行此过程通过向服务器发送json-rpc请求来获取一些信息,我我是第一次成功获得它但是当我发送第二个请求时,我收到一个404错误的空响应(找不到页面).但是当我在没有https(仅限http)的情况下调用该服务时,无论我多少次调用它,它都能正常工作!

   public async Task<string> GetDataFromServer(string urlToCall, string JSONData,string RR)
        {
            string UserName = “XXXXXXX”
            string Password = "XXX";

            using ( var handler = new HttpClientHandler())
            {
                handler.Credentials = new NetworkCredential(UserName, Password);
                HttpClient client = new HttpClient(handler);

                HttpResponseMessage response = null;

            try
            {


                response = await client.PostAsync(urlToCall, new StringContent(JSONData.ToString(), Encoding.UTF8, " application/json"));
               string res = response.Content.ReadAsStringAsync().Result;




                Windows.UI.Popups.MessageDialog g = new Windows.UI.Popups.MessageDialog(res);
                await g.ShowAsync();
                return res;

            }
            catch (Exception ex)
            {


                Windows.UI.Popups.MessageDialog g = new Windows.UI.Popups.MessageDialog("Error is : " + ex.Message); …
Run Code Online (Sandbox Code Playgroud)

json json-rpc windows-phone-8

7
推荐指数
1
解决办法
977
查看次数

在Windows Azure虚拟机VM上安装FTP应用程序FileZilla Server

在Azure虚拟机VM上,如何正确安装FileZilla服务器应用程序?然后如何将您的网站发布到您的VM?如何在Azure上为FTP FileZilla Server打开端口以及如何连接它?

ftp azure

7
推荐指数
1
解决办法
7478
查看次数

以编程方式从Windows Phone 8.1 XAML中的ListView中的特定ListViewItem到达TextBlock

我是Windows Phone 8.1的新开发人员,我尝试从ListView集合中获取特定的ListView项目,并能够为其内部的TextBock着色或着色,但我无法访问该项目或达到任何项目在ListView内部,请查看我的以下代码:

    protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
                   SQLiteRT db1 = new SQLiteRT();
            var db_connection = await db1.Connection("MyDB.sqlite");

            List<MyTBL> t_list = db1.GetTable("SELECT * FROM MyTBL LIMIT 4 ORDER BY RANDOM() ;");
            db_connection.Close();

          LV_Options.ItemsSource = t_list;
    }
 // my List View called LV_Options
private void LV_Options_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
     ListView lv1 = sender as ListView;
     if (lv1 == null)
          return;

     MyTBL wrd = lv1.SelectedItem as MyTBL;
     if (wrd == null)
         return;

     TextBlock tb = lv1.FindName("TB_AMean1") as TextBlock;
     tb.FontSize …
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-phone-8 windows-phone-8.1

6
推荐指数
1
解决办法
2004
查看次数

JQuery Mobile,如何以编程方式强制进行方向更改

抛出JQuery Mobile是否有任何方法可以通过代码显示"横向页面",我不想使用orientationchange但我想以编程方式触发它!

任何帮助,

jquery-mobile

5
推荐指数
1
解决办法
3281
查看次数

如何忽略ASP.NET MVC 4中特定View文件夹或特定cshtml文件的路由

我想在浏览Views文件夹中的特定页面时忽略路由,我通过使用未成功尝试:

        routes.RouteExistingFiles = false;
    routes.IgnoreRoute("Views/NoMove/specificPage.cshtml");
Run Code Online (Sandbox Code Playgroud)

但上面没有用,因为互联网浏览器要求我下载文件,它不会打开/处理它的页面!

有什么问题,以及如何解决它!

asp.net-mvc asp.net-mvc-4

5
推荐指数
1
解决办法
751
查看次数

有没有办法从indexeddb中检索随机行

我想从餐桌上检索一个随机行,这样做的方法是什么?

我的代码:

var transaction = db.transaction(["meals"], "readonly");
var store = transaction.objectStore("meals");
var index = store.index("time");  // to search in the field time type
range = IDBKeyRange.only(3);      // 3 means it is a lunch 

index.openCursor(range).onsuccess = function (e) {
var dt = event.target.result;
    if (dt) {
         var s = dt.value['fno1'];
             }
 };
Run Code Online (Sandbox Code Playgroud)

javascript jquery html5 indexeddb

5
推荐指数
1
解决办法
333
查看次数

通过使用时刻javascript我需要添加小时(不增加或添加分钟)/圆到最近的小时或月或年

通过使用时刻js,当我想加1小时到当前时间时,我只想增加小时而不是分钟?所以时间03:25将是04:00而不是04:25(这是错误的)

// below increase 60 minutes while I only need to round to the nearest hour
$('#eventTime').val(moment().add(1, 'hours').format('HH:mm'));
Run Code Online (Sandbox Code Playgroud)

希望解决方案在圆到最近的月份(到下个月的第一天)或一年等时也能正常工作......

javascript jquery momentjs

5
推荐指数
1
解决办法
9261
查看次数

如何使用身份验证通过NLog或SeriLog登录到Elastic Search

我们目前使用的是Azure规模集(一个源组上的许多VM具有负载平衡和一个可用性集),我们曾经使用NLog来记录Web应用程序的操作和错误,但现在我们要求/需要使用Elastic Search,并且还使用所有Azure虚拟机实例的集中式日志,而不是每个实例的文件。

我是ES和LogStash概念的新手,是否需要用其他东西代替NLog?以及如何使用ES并统一所有日志(我想将nlog存储在azure存储表中作为统一结果,还是我需要使用LogStash还是您更喜欢其他东西)?

如上所述,在Azure多个VM上提供对.net核心应用程序支持的最多记录是什么?

有什么帮助吗?

asp.net nlog elasticsearch logstash serilog

4
推荐指数
3
解决办法
5856
查看次数

到达/访问MVC中IEnumerable对象中的特定索引

我需要从IEnumerable @model访问一个特定的项目;

我知道我可以通过以下代码到达所有项目:

@foreach (var item in Model) {
    <tr>
        <td>
        @Html.DisplayFor(modelItem => item.FoodName)
        </td>
}
Run Code Online (Sandbox Code Playgroud)

但是我需要通过做类似的事情来访问第三个项目(例如):Model [3] .FoodName

有没有办法从MVC中的IEnumerable对象到达特定的索引项?

asp.net-mvc asp.net-mvc-3

3
推荐指数
1
解决办法
2117
查看次数

将位图流上载到Azure存储时,它存储零/空图像

我使用下面的代码将MemoryStream从位图图像上传到我的Microsoft Azure存储帐户:

                         MemoryStream memoryStream = new MemoryStream();

                       img.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);

                       blob.Properties.ContentType = model.File.ContentType;
                       blob.UploadFromStream(memoryStream);
Run Code Online (Sandbox Code Playgroud)

使用上面代码发生的是它将空图像上传到Azure存储:(!(我找到了名称,但文件大小为零!)!

       if (model.File != null && model.File.ContentLength > 0)
                {
                    Bitmap original = null;
                    var name = "newimagefile";
                    var errorField = string.Empty;

                    errorField = "File";
                    name = Path.GetFileNameWithoutExtension(model.File.FileName);
                    original = Bitmap.FromStream(model.File.InputStream) as Bitmap;
                   if (original != null)
                     {
                       var img = CreateImage(original, model.X, model.Y, model.Width, model.Height);



                       CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                                   CloudConfigurationManager.GetSetting("StorageConnectionString"));

                       CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

                       CloudBlobContainer container = blobClient.GetContainerReference("company"); // must always be lowercase
                                                 container.CreateIfNotExists();

                       container.SetPermissions(
       new …
Run Code Online (Sandbox Code Playgroud)

cloud asp.net-mvc azure

3
推荐指数
1
解决办法
892
查看次数