tag:blogger.com,1999:blog-39247396364079072022024-03-08T21:28:06.868-03:00HunabKuIT experiencesFabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.comBlogger195125tag:blogger.com,1999:blog-3924739636407907202.post-74649403694059082242017-04-16T22:15:00.001-03:002017-04-26T16:05:55.091-03:00API-APP server-to-server through Azure Active DirectoryIn the previous post you see how register your API app in the AAD and how register a client app to then access using RESTful AAD api. The work to do to access your API is not so much using any langue, btw is even more easy using .NET.
The POC
Creates a new Console project and then add Microsoft.IdentityModel.Clients.ActiveDirectory package.
Now add this class to your project
using Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-55845710755760455062017-04-16T01:00:00.001-03:002017-04-16T01:03:15.675-03:00Web API access through Azure Active DirectoryIn the past year I realized that is not so clear that any request arrive to our Web app or API app was analyzed by a Gateway; after deliver an API the question was the same: “Nice! the API is the opened to the world, how we can protect the access to our API ?”
The picture
As you can see the gateway is already there; is you don’t activate the authentication it just send, to your app, all Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-9942068155870357032017-01-16T09:30:00.000-03:002017-01-31T09:21:34.114-03:00Azure queues by conventionEl codigo que voy a mostrar hoy viene corriendo, con pocas variaciones a lo largo del tiempo, desde el 2009 cuando Azure era CTP así que somos ya varios que lo tenemos a mano (algo había compartido en el medio del camino).
Las interfaces
Como siempre es buena norma, por lo menos cuando se trata de servicios, empezar por las interfaces; más aún si terminan involucrados en varios proyectos que Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com1tag:blogger.com,1999:blog-3924739636407907202.post-66658856393175583932017-01-10T22:17:00.000-03:002017-01-10T22:28:20.700-03:00Azure IoT Hub a puro RESTEl año pasado, en una reunión con el colorado el ruso y el pibe, me pidieron un ejemplo de uso de Azure IoT Hub sin usar el SDK. Yo pensaba que con un poco de GoogleFu algo iba a encontrar pero… nada.
En lugar de seguir buscando codigo y ya que todo, o casi, en Azure tiene API REST empecé a leer la documentación de la API y a codear.
Si quieren probar el codigo de este post, a parte un account Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-33432187133303442242012-04-05T16:51:00.001-03:002012-04-05T16:52:36.971-03:00NHibernate: autocreate indexes for foreignkeyIn these last days we have fallen in a performance issue with one of our DBs; the last and littlest one.
The creation of indexes on FKs seems to be a best-practice for MS-SQL-server and ORACLE and is not needed with Firebird; in Firebird instead than a best-practice is the default behavior: the FK includes an index.
That said I have to be sure that each FK has to have an index. After check our Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com15tag:blogger.com,1999:blog-3924739636407907202.post-16319568412957106152011-11-19T16:29:00.001-03:002011-11-19T16:29:55.362-03:00Azure queues: ProducerIf you have read something about Azure’s queue you have probably seen some picture like this: A producer is anything (a class) that, in some moment, enqueue a message; more exactly this “anything” is something that take the role of message producer. For example it can be a MVC controller, more usually it can be an application-service or a domain-event but it can be even a view. To simplify the Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com3tag:blogger.com,1999:blog-3924739636407907202.post-26303766025817135372011-11-10T15:50:00.001-03:002011-11-10T15:50:30.295-03:00MVC3 : set active menu by controller nameJust as a “nice to have” in the default templates of MVC. In the default CSS of MVC3 you can find some styles never applied. One of those style is about the selected menu: ul#menu li.selected a { background-color: #fff; color: #000; } In the _Layout.cshtml would be nice to have something like this: <script type="text/javascript"> $(document).ready(Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com3tag:blogger.com,1999:blog-3924739636407907202.post-81828020153379453302011-10-29T10:19:00.002-03:002011-10-29T10:29:26.885-03:00Azure HispanoEn estos dos años fue bastante dificil compartir experiencias o aclarar dudas desarrolando para Windows Azure Platform.
Con la ayuda de @guadacasuso, @nahog, @gabrielsz, Fernarndo Aramburu, @aeidelman, @AleBanzas entre otros (disculpen si no recuerdo todos los nombres/links) nació ayer un nuevo grupo de habla hispana para que sea mas facil para todos compartir experiencias, conocimiento y/o Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-40259880645522710192011-08-13T16:18:00.001-03:002011-08-13T16:18:18.602-03:00Parse string as Razor templateFor a special requirement at work (actually a mix with self requirement) I need to get a chunk of HTML content from a persistence-system. Taken as is, it does not appear a big challenge but analyzing the problem a little bit more deeper I saw that that the HTML chunk may contain variables, it may need a model… to be short it may be so complex as a MVC-PartialView. To achieve the target quickly I Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com9tag:blogger.com,1999:blog-3924739636407907202.post-72066450390902789272011-08-06T16:10:00.001-03:002011-08-06T16:10:29.306-03:00Azure storage initializationThis is the “self response” to the previous post. When your role starts on Azure there are some tasks which runs synchronously and some tasks which runs asynchronously. For complex startups you can set the configuration of each custom tasks in your ServiceDefinition.csdef. If you don’t need special tasks to setup your VM you will end initializing your Azure-storage (blob containers, tables and Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-91452144146520202872011-07-19T13:34:00.001-03:002011-07-19T13:34:01.915-03:00Azure Storage initializationMore than a post about “how initialize the Azure storage” this is a “bottle to sea” to check if somebody else known a best-practice, a recommendation or whatever you call it. In the past year we had experimented the very nice and useful exception starting our Web-Role… if you have an application on Azure I’m pretty sure you saw it too: Very nice and informative, even better than some of our Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com2tag:blogger.com,1999:blog-3924739636407907202.post-70240856134102234552011-07-17T15:38:00.001-03:002011-07-17T15:39:38.786-03:00NHibernate: playing with mapping by code (2)
In the previous post you saw a simple example about a way to use the new mapping-by-code of NHibernate 3.2.0.
The class-by-class mapping will be, probably, the most used way just because it is very similar to the XML mapping and the “feeling of loss of control” is near to zero (the quiet of sense).
If you want experiment more adrenaline you can try ConfORM but if you like just a little bit of Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com7tag:blogger.com,1999:blog-3924739636407907202.post-26459877199915518662011-07-16T18:27:00.004-03:002011-07-17T13:26:10.710-03:00NHibernate: playing with mapping by codeNHibernate 3.2.0GA is going to be released and, around the NET, there are various questions about how use its “sexy-mapping”… “sexy-mapping” is not a serious definition? well… I’m bored by zero-one definitions.
I think that the “problem” is that I have explicitly avoided to call something “best practice” writing my examples (as I done with ConfORM) and the new mapping-by-code is very Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com18tag:blogger.com,1999:blog-3924739636407907202.post-64401496878511244682011-07-09T14:41:00.003-03:002011-07-09T14:54:27.621-03:00Using ConfORM with modular applicationI’m getting some questions about how use ConfORM in modular applications. The first commercial application mapped with ConfORM is a pretty complex modular application and if you have a look to the first ConfOrm example you can find the IModuleMapping.
Here I’ll try to explain how we have used it in that application writing a new example.
The IModuleMapper/// <summary>
/// A template to Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com10tag:blogger.com,1999:blog-3924739636407907202.post-30166862972614087482011-07-05T09:34:00.001-03:002011-07-05T09:34:17.557-03:00An amazing tool to improve your work in .NETIf you are a .NET developer, when you have 25 minutes free, have a look to the @hhariri’s video about the new features of ReSharper 6. This is not an advertise, this is an advise, really. I’m using Resharper since some years and I have noticed the big difference when I do pair programming with somebody who does not have Resharper installed. Well… now you have the power of Resharper even in the Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com1tag:blogger.com,1999:blog-3924739636407907202.post-57428252321117819722011-06-24T19:10:00.001-03:002011-06-24T19:10:24.318-03:00C# OAuth for TESTardiThese days we was looking a way to use OAuth in our application to add some service to our customers. As usual I done some investigation before start doing something by myself and I have found some frameworks, some example, some sources… as usual. I am a TESTardo (in Spanish is TESTarudo and in English “headstrong”) and I would understand what is going on behind those hundreds lines of C# code. Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com2tag:blogger.com,1999:blog-3924739636407907202.post-83012755100385187602011-05-13T17:36:00.001-03:002011-05-13T17:36:14.951-03:00NHibernate: The bizarre AuditThis is another post tagged as “wasting time”; in this occasion thanks to Scott Findlater and Filip Kinský (@Buthrakaur). The title is because there are people who think that having four properties to store a DateTime of an entity creation, the User who have created it, the DateTime of the last modification and the User who have modified it mean that his application has auditing. If you are a Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com6tag:blogger.com,1999:blog-3924739636407907202.post-932159138147177502011-04-18T04:00:00.014-03:002011-04-18T04:00:08.649-03:00me on Fluent NHibernateWell… from where I should start ?…?? Perhaps from “Mapping Source: How map a class without use XML” mmm… no, better no because it is too old and was classified as “too complicated”. Perhaps from “Map NHibernate using your API” mmm… no, better no because it is one year old and was classified as “too silly” as you can read in the comments of this post and in this other. What about this “NHibernate Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com61tag:blogger.com,1999:blog-3924739636407907202.post-22382641237608771382011-04-13T20:47:00.001-03:002011-04-13T20:47:46.201-03:00NHibernate 3.2: mapping by code conventions After see some characteristic of one of the new NHibernate 3.2 feature it’s the time to see if the mapping by-code gives support to a convention based mapping. In NHibernate there isn’t a real difference between declarative-mapping and convention-based-mapping because every thing live together since the first commit. What you will see in this post is defined, by some people, as “auto-mapping”. Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com11tag:blogger.com,1999:blog-3924739636407907202.post-77303160566714559592011-04-08T15:01:00.001-03:002011-04-08T15:01:43.562-03:00NHibernate 3.2: (part 2) mapping by code In the first post about the new mapping-by-code feature you saw only the very first presentation. I’ll will try to write more posts about this new feature and all its secrets even if you can learn more using ConfORM. As in ConfORM even the NHibernate’s mapping-by-code is smarter than XML mapping and may help you in many cases. Well… it is not so smart as ConfORM but smart enough to prevent Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com25tag:blogger.com,1999:blog-3924739636407907202.post-1401578920671589132011-04-01T14:11:00.001-03:002011-04-01T14:11:32.836-03:00NHibernate 3.2 mapping by codeNHibernate 3.2 will come with its own embedded mapping by code. If you want know it is not based in fluent-interface, instead it is based on “loquacious”. That said you should understand that it has nothing related with Fluent-NHibernate. The main idea under the NHibernate’s “sexy mapping” came from my dear ConfORM. In the past year the no conformist red man was running a lot and now I’m ready toFabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com39tag:blogger.com,1999:blog-3924739636407907202.post-75862357181367004342011-03-22T13:52:00.001-03:002011-03-22T13:52:34.451-03:00NHibernate 3.2 batching improvementThis post is about an old missed feature in NHibernate batching. I have mentioned this feature in this post but again I forgot it. How old is it ? what about 2007-09-15 ? yes, so old. The domain The little test using (ISession s = OpenSession()) using (s.BeginTransaction()) { for (int i = 0; i < 12; i++) { var user = new User {UserName = "user-" + i}; var Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com6tag:blogger.com,1999:blog-3924739636407907202.post-54709765527515307972010-11-15T10:17:00.029-03:002010-11-15T19:47:26.795-03:00ConfORM : Any-to-ManyIn the previous post I have asked a help about well known implementation patterns using interfaces in relations. Even if the feedback was zero I’m happy to say that ConfORM is now supporting case-1-2-3-4. In the meaning I was thinking about the case-6.
An interface is implemented by more than one root-entity or no-root-entity, and thus by its own hierarchies, and it is used as a Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com1tag:blogger.com,1999:blog-3924739636407907202.post-87840027238098240652010-11-05T15:44:00.003-03:002010-11-06T15:58:10.417-03:00ConfORM : Thoughts about interfaces as relationAs said in the previous post the most “easy” part related to polymorphism is done. Now is the time to give more intelligence to the “muchachota” (some BuenosAires guy will understand what it mean… btw, for others, with “muchachota” I’m referring to ConfORM project).
I need your help thinking about the behavior that ConfORM should have in these cases:
Case 1:
An interface is implemented Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0tag:blogger.com,1999:blog-3924739636407907202.post-47847263196851556912010-11-04T15:15:00.000-03:002010-11-04T15:15:31.652-03:00ConfORM: understanding polymorphism (interfaces)The Domain
Three entities and two components some ones implementing the same interface.
The mappingvar entities = new[] { typeof(User), typeof(Email), typeof(InstantMessage) };
var orm = new ObjectRelationalMapper();
orm.TablePerClass(entities);
var mapper = new Mapper(orm);
mapper.Customize<IHasMessage>(x => x.Property(hasMessage => hasMessage.Message, pm => { pm.Type(Fabio Maulohttp://www.blogger.com/profile/13558454874302740335noreply@blogger.com0