Does anyone know how to get the creation time of a stream from azure-datalake-store SDK? - azure-data-lake

I just found the "lastModifiedTime" and "ExpiryTime" in the class DirectoryEntry.

You can get or set the DateTimeOffset when the File was created using Microsoft.Azure.Storage.File SDK.
public DateTimeOffset? CreationTime { get; set; }
Refer: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.file.fileproperties.creationtime?view=azure-dotnet-legacy

Related

Adding warehouse selector to the custom field in acumatica

I created a custom field and trying to add the warehouse selector to it.I try to read from the customization guide and tried it but,the selector does not show up in the custom field.
This is the code I tried.
#region UsrCustomSite
[PXDBInt]
[PXUIField(DisplayName="Warehouse", Visibility = PXUIVisibility.SelectorVisible)]
[PXSelector(typeof(Search<IN.INSite.siteCD>),typeof(IN.INSite.descr),DescriptionField =(typeof(IN.INSite.siteCD)),SubstituteKey =(typeof(IN.INSite.siteCD)),DirtyRead =true)]
public virtual int? UsrCustomSite { get; set; }
public abstract class usrCustomSite : PX.Data.BQL.BqlInt.Field { }
#endregion
Am I missing something here?
I would try changing
[PXSelector(typeof(Search<IN.INSite.siteCD>)
to
[PXSelector(typeof(Search<IN.INSite.siteID>)
You are storing an int so you want the id, the substitute Key setting will make it so that the UI will show the CD.

Validate existing entity in CQRS + EventSourcing. Microservice ASP.NET Core 5.0

I am currently building an app, and I would like to use micro services.
I use Mediatr for implementing a CQRS pattern and EventStore for event sourcing.
I have a problem with checking that an entity exists before creating an event of aggregate and appending it to the EventStore.
For example: I have LanguageAggregateRoot
public class LanguageAggregateRoot
{
public Guid Id {get;set}
public string Code { get; private set; }
public string Name { get; private set; }
public bool Enable { get; private set; }
public string Icon { get; private set; }
}
Field Code is unique and user can change code for language.
When I use Code field for stream id of eventstore, if the user sends a CreateLanguageCommand and ChangeCodeCommand, I need to check that the new code exists.
So I use Id field for stream id. But I don't understand how I can validate whether code field is unique?
As far as I've found out should not use query handling in command handling.
If i use client to check existed then send command to server. I think it doesn't look good. Because something/someone can request only command with out my client.
How can I do that?
Thanks for your support.
It should be fine to validate your request in your command itself.
you can use the below link for more details.
CQRS - is it allowed to call the read side from the write side?

How can I bind sample data from a variable of type List<string> inside a class to the XAML (design) page

I've been making use of binding to sample data so that I can get a feel of what the app is going to look like during runtime.
Things have been going great until I had to bind to a List<>. I made a sample application to demonstrate the problem.
Person.cs
public string FullName { get; set; }
public int Age { get; set; }
public string Sex { get; set; }
public List<string> Friends { get; set; }
MainViewModelSampleData.xaml
<vm:MainViewModel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:StackoverflowQuestion.ViewModels">
<vm:MainViewModel.Items>
<vm:Person FullName="Homer Simpson" Age="45" Sex="Male" />
<vm:Person FullName="Bruce Wayne" Age="32" Sex="Male" Friends="" />
</vm:MainViewModel.Items>
I can get the design view to correctly shows the string FullName, int Age, and string Sex.
What I don't know and can't figure out is how to bind data from List<string> Friends so that I can view it on the design view.
The solution is 'extracting' the Friends value
<vm:Person FullName="Bruce Wayne" Age="32" Sex="Male">
<vm:Person.Friends>
<x:String>First</x:String>
<x:String>Second</x:String>
</vm:Person.Friends>
Depending on the version of App x:String is necessary or the literal directly
<vm:Person FullName="Bruce Wayne" Age="32" Sex="Male">
<vm:Person.Friends>
First
Second
</vm:Person.Friends>
And the last option is add the following namespace
xmlns:System="clr-namespace:System;assembly=mscorlib"
<phone:PhoneApplicationPage.DataContext>
<local:Person Name="ww">
<local:Person.Friends>
<System:String>one</System:String>
<System:String>one</System:String>
</local:Person.Friends>
</local:Person>

WCF DataContract Versioning

Alright here goes nothing. After reading Best Practices on Service Versioning and Data Contract Versioning (http://msdn.microsoft.com/en-us/library/ms733832.aspx) I mostly understand how its all done. I am planning to use Agile Versioning for Data Contracts but cant figure out what the difference or better practice is between Creating a WorkRequestV2 to add new properties or just adding the new properties to WorkRequestV1. Now I tried doing both ways and it worked but when I do create WorkRequestV2 I have to modify ServiceContractor to use WorkRequestV2 why do this rather than just adding properties to WorkRequestV1? What is the difference?
The Example I looked at was here (http://msdn.microsoft.com/en-us/library/ms731138.aspx)
CarV1 and CarV2 why not add HorsePower to CarV1 and not have to create a whole new Contract.
[DataContract(Name = "WorkRequest")]
public class WorkRequestV1 : IExtensibleDataObject {
[DataMember(Name = "workrequest",Order=1,IsRequired=true)]
public int workrequest { get; set; }
[DataMember(Name = "CQ")]
public string CrewHeadquarter { get; set; }
[DataMember(Name = "JobCode")]
public string JobCode { get; set; }
[DataMember(Name = "JobType")]
public string JobType { get; set; }
[DataMember(Name = "Latitude")]
public string Latitude { get; set; }
[DataMember(Name = "Longitute")]
public string Longitute { get; set; }
private ExtensionDataObject theData;
public ExtensionDataObject ExtensionData {
get {
return theData;
}
set {
theData = value;
}
}
}
Have another read of the Data Contract versioning (your second link)
Here is a quote from that page:
Breaking vs. Nonbreaking Changes
Changes to a data contract can be
breaking or nonbreaking. When a data contract is changed in a
nonbreaking way, an application using the older version of the
contract can communicate with an application using the newer version,
and an application using the newer version of the contract can
communicate with an application using the older version. On the other
hand, a breaking change prevents communication in one or both
directions.
For your case, adding some additional properties is a non-breaking change. You can quite safely add the properties to the existing data contract rather than create a new one, as long as you don't have strict schema validation (such as the new properties don't have 'required' marked on them)
Old clients communicating with new services still continue to work, values of the new properties will remain the default value. New clients communicating with old services will also work, as the new properties will be ignored.
But as you can see, you will run into the problem of how can you ensure new clients communicate with new services, and old clients with old services? If this isn't an issue, then you don't have a problem. Otherwise you may need to introduce a new data contract.
Further reading:
MSDN Service Versioning
IBM Best practice for Web service versioning
Oracle Web services versioning
What are your WebService Versioning best practices?

How do you send complex objects using WCF? Does it work? Is it good?

Can I have a data contract of this shape??
[DataContract]
public class YearlyStatistic{
[DataMember]
public string Year{get;set;}
[DataMember]
public string StatisticName {get;set;}
[DataMember]
public List<MonthlyStatistic> MonthlyStats {get;set}
};
I am assuming here that class MonthlyStatistic will also need to be a DataContract. Can you do this in a web service?
To use the same model for web services, mark your class as Serializable use the XmlRoot and XmlElement in the System.Xml.Serialization namespace. Here is a sample using your example:
[Serializable]
[XmlRoot("YearlyStatistic")]
public class YearlyStatistic
{
[XmlElement("Year")]
public string Year { get; set; }
[XmlElement("StatisticName")]
public string StatisticName { get; set; }
[XmlElement("MonthlyStats")]
public List<MonthlyStatistic> MonthlyStats { get; set; }
}
You will have to do the same thing for your complex object properties of the parent object.
Yep, thats standard WCF serialization right there. Are you trying to say the MonthlyStats collection has a property called WeeklyStats, or that each individual MonthlyStatistic has a WeeklyStat collection? If its the former, that doesnt work in WCF natively. You will have to do some fiddling in order to get it to work. If its the latter, its perfectly fine.
Yes, you can send the data contract you mentioned above back and forth from a WCF service. Like you said, MonthlyStatistic and all its members will have to be defined as data contracts themselves or be built in types (like strings).
You can even send and receive more complex types like when you have a base class but want to send or receive an object of a derived class (you would do that using the KnownType attribute). While receiving (de-serialization), from Javascript, there's a trick using which you have to specify the type for WCF. If you are interested, feel free to ask.